JSFiddle - React, Tailwind, and code Playground
by PiereDome
HTML
<canvas id='canvas'></canvas>
JavaScript
//WebGL Framework by BP
(function(window, undefined) {
BPGL = {
//array containing elements in order to chain
elems: [],
//GetById Method
getById: function() {
var tempElems = [];
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == 'string') {
tempElems.push(document.getElementById(arguments[i]));
}
this.elems = tempElems;
return this;
}
},
//add a new CSS Class
addClass: function(name) {
for(var i = 0; i< this.elems.length;i++){
this.elems[i].className += ' ' + name;
}
return this;
}
}
if(!window.$3D){ window.$3D = window.BPGL = BPGL;}
})(window);
$3D.getById('canvas').addClass('Urkle');