I am brand new to A-frame so apologies if this is a very obvious question. Using A-frame with javascript, I am changing the attribute of various elements when an event occurs (in this case a mouseover of another element but I don't only want to be able to affect the moused element). How can you animate a change to an attribute within the component? Please see below an example of my question, when you gazeover the blue box the red box shifts position. This is a simple example but this is a more general question though about how to achieve this behaviour. You can see I include the animation script in the head but in the examples of this used it is only for constant behaviour and I don't know how to update it dynamically. I'm also aware of the animation tag I could add to the HTML but again I don't know how to affect this. Many thanks for any advice.
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<meta name="description" content="Hello, WebVR! - A-Frame">
<!-- a-frame library -->
<script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
<!-- a-frame animation plugin -->
<script src="scripts/animation.js"></script>
<script>
AFRAME.registerComponent('cursor-listener', {
//initiate
init: function () {
//add behaviour for mouse enter (or gaze enter)
this.el.addEventListener('mouseenter', function (evt) {
var otherBox = document.querySelector('#otherbox');
otherBox.setAttribute('position', '-2 1 -4');
});
}//end initiate
});//end registerComponent
</script>
</head>
<body>
<a-scene>
<a-sky>
</a-sky>
<a-box cursor-listener position="0 1 -4" color="blue">
</a-box>
<a-box id="otherbox" position="-1 1 -4" color="red">
</a-box>
<a-camera>
<a-cursor>
</a-cursor>
</a-camera>
</a-scene>
</body>
</html>