我是AFRAME的新手,我希望当光标在某个实体上移动时,会有一个环(或光标)一点一点地用绿色着色,此动作将通知触发保险丝的剩余时间。 AFRAME能做到吗?
答案 0 :(得分:0)
是。以下是比例示例:
https://aframe.io/docs/0.3.0/components/cursor.html#adding-visual-feedback
<a-entity cursor="fuse: true; fuseTimeout: 500"
position="0 0 -1"
geometry="primitive: ring"
material="color: black; shader: flat">
<a-animation begin="click" easing="ease-in" attribute="scale"
fill="backwards" from="0.1 0.1 0.1" to="1 1 1"></a-animation>
<a-animation begin="cursor-fusing" easing="ease-in" attribute="scale"
fill="forwards" from="1 1 1" to="0.1 0.1 0.1"></a-animation>
</a-entity>
要做一个圆圈,你可以动画圆圈的thetaLength而不是缩放,使它在融合时画一个圆圈。
<a-entity cursor="fuse: true; fuseTimeout: 500"
position="0 0 -1"
geometry="primitive: ring"
material="color: black; shader: flat">
<a-animation begin="click" easing="ease-in" attribute="scale"
fill="backwards" from="0.1 0.1 0.1" to="1 1 1"></a-animation>
<a-animation begin="cursor-fusing" easing="ease-in" attribute="geometry.thetaLength"
fill="forwards" from="0" to="360"></a-animation>
</a-entity>