A-Frame Animation + Events
by donmccurdy
HTML
<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
<a-scene>
<a-sphere id="ball" material="color: red" position="0 3 -5">
<a-animation attribute="position"
from="0 3 -5"
to="0 0 -5"
dur="500"
begin="bounce-start"
end="bounce-stop"
fill="backwards"
easing="ease-in"
repeat="indefinite"></a-animation>
</a-sphere>
</a-scene>
JavaScript
/**
* Click the scene to start/stop the bouncing.
*/
var bouncing = false;
document.addEventListener('click', function () {
bouncing = !bouncing;
var el = document.querySelector('#ball');
el.emit(bouncing ? 'bounce-start' : 'bounce-stop');
});