Aframe (how to?) Animate entity or entities with b

2019-06-08 17:26发布

问题:

This is the menu:

How do I animate an entity, so that upon an event like a click, it does simultaneous scaling, rotation, positioning, and sequential scaling, rotation, positioning.

    <a-curve id="track1">
    <a-curve-point position="4 2 -3"></a-curve-point>
    <a-curve-point position="6 5 -2"></a-curve-point>
    <a-curve-point scale="10 -3 -1"></a-curve-point>

    </a-curve>

    <a-cylinder position="5 0.75 -3" radius="0.5" height="1.5" color="#FFC65D" shadow>
    <a-animation alongpath="curve: #track1" begin="click"></a-animation>
    </a-cylinder>

回答1:

Event-triggered animations:

<a-entity animation__1="startEvents: someevent" animation__2="startEvents: someevent">

Then emit:

el.emit('someevent');

For sequential, see https://www.npmjs.com/package/aframe-animation-timeline-component