Skip to content

Instantly share code, notes, and snippets.

@cwervo
Last active February 13, 2020 22:27
Show Gist options
  • Save cwervo/7669c10232a8aa6035ec71d9e91346a0 to your computer and use it in GitHub Desktop.
Save cwervo/7669c10232a8aa6035ec71d9e91346a0 to your computer and use it in GitHub Desktop.
A < 20 line (Hack-ish) A-Frame Outline Geometry component
AFRAME.registerComponent('outline-geometry', {
schema : {
margin : { default : 1.025 },
color: { default : 'red' },
},
init : function () {
var p = this.el;
var p_prime = p.cloneNode(true);
p_prime.removeAttribute('outline-geometry')
p_prime.setAttribute('material', 'color', this.data.color)
p_prime.setAttribute('material', 'side', 'back')
p_prime.setAttribute('position', '0 0 0')
let s = this.data.margin
p_prime.setAttribute('scale', `${s} ${s} ${s}`)
this.el.appendChild(p_prime)
}
})
@cwervo
Copy link
Author

cwervo commented Oct 5, 2017

Here it is ✨in real life✨

oct-05-2017 01-10-30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment