JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
<script>
AFRAME.registerComponent('rotatebox', {
init: function() {
// animation
let opacityAnimation = document.createElement('a-animation');
opacityAnimation.setAttribute('attribute', 'material.opacity');
opacityAnimation.setAttribute('to', '0');
opacityAnimation.setAttribute('dur', '5000');
this.el.appendChild(opacityAnimation);
}
})
</script>
<a-scene>
<a-box position="0 1 -2" rotatebox>
</a-box>
</a-scene>