![](/img/trans.png)
[英]How to listen to click event on Android Chrome in WebVR/A-Frame?
[英]Event set component using a collada object in A-Frame (webvr)
我正在尝试使用用于A帧的事件集组件插件在collada对象上创建旋转动画,我已经能够成功地使用a-box实现此功能,但希望对collada对象进行动画处理。 由于某种原因,我看不到collada对象,也不知道我要去哪里。 请查看下面的代码以获取更多信息,我们将不胜感激任何帮助,谢谢。
<html>
<head>
<title>Model Test</title>
<script src="build.js"></script>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="aframe-animation-component.min.js"></script>
<script src="component/event-proxy.js"></script>
<script src="https://unpkg.com/aframe-event-set-component@3.0.x/dist/aframe-event-set-component.min.js"></script>
<script src="https://unpkg.com/aframe-layout-component@4.1.0/dist/aframe-layout-component.min.js"></script>
</head>
<body>
<a-scene>
<a-entity id="container" position="0 0 -2">
<a-collada-model src="iPhone4.dae"
animation__rotationX="property: rotation; dur: 10000;
easing: easeInSine; loop: true; to: 0 360 0;
startEvents: rotY; pauseEvents: animationPause;
resumeEvents: animationResume; restartEvents: animationRestart"
animation__rotationY="property: rotation; dur: 10000;
easing: easeInSine; loop: true; to: 360 0 0;
startEvents: rotX; pauseEvents: animationPause;
resumeEvents: animationResume; restartEvents: animationRestart"
position="0 1 -2">
</a-collada-model>
<a-mixin id="option"
geometry="primitive: sphere; radius: .25;"
material="color: red"
event-proxy="listen: click; target: a-collada-model"
></a-mixin>
<a-entity position="-2.5 0 0">
<a-entity mixin="option" event-proxy="emit: rotY" text="value: Rotation"></a-entity>
</a-entity>
<a-entity position="2.5 0 0">
<a-entity mixin="option" event-proxy="emit: rotX" text="value: Rotation"></a-entity>
</a-entity>
<a-entity position="0 -1.5 0">
<a-sphere mixin="option" event-proxy="emit: animationPause" text="value: Pause"></a-entity>
</a-entity>
</a-entity>
<!-- Sky. -->
<a-sky color="#0fbbff"></a-sky>
<a-entity position="0 0 3">
<a-camera><a-cursor color="#FFF"></a-cursor></a-camera>
</a-entity>
</a-scene>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.