Skip to content Skip to sidebar Skip to footer

Aframe.io: Add Border To On Mouseover Using

How would I add a border to a curved image when selected? The following code will change the material color of the image however I'd prefer to add a border or glow instead. AFRAME.

Solution 1:

Create a slightly bigger <a-curvedimage> behind yours, but don't give it an image texture src, just provide a solid color and perhaps toggle opacity/visibility.

AFRAME.registerComponent('selectable', {

    init: function () {
        var el = this.el;
        var backgroundEl = el.sceneEl.querySelector('#backgroundEl');
        this.el.addEventListener('mouseenter', function (evt) {
            backgroundEl.setAttribute('visible', true);

        });
        this.el.addEventListener('mouseleave', function (evt) {
            backgroundEl.setAttribute('visible', false)
        });

    }
});

Post a Comment for "Aframe.io: Add Border To On Mouseover Using"