Reputation: 536
Is it possible to add text to a-sphere or a-box ? or may be show a text box on mouse over on a-sphere? I've seen the example in A-frame, but it is not exactly what I want. My idea is to tag a sphere or a box with a text or text box.
Upvotes: 0
Views: 758
Reputation: 13233
<script>
AFRAME.registerComponent('hover-text', {
schema: {
value: {default: ''}
},
init: function () {
var data = this.data;
var el = this.el;
el.addEventListener('mouseenter', function () {
el.setAttribute('text', {content: data.content});
});
}
});
</script>
<a-entity hover-text="value: I am hovered."></a-entity>
Upvotes: 1