This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (paths) => { | |
const rules = []; | |
Array.prototype.forEach.call(document.styleSheets, (sheet) => { | |
Array.prototype.forEach.call(sheet.cssRules, (rule) => { | |
paths.forEach((path) => { | |
if (rule.selectorText && rule.selectorText.endsWith(`${path[0]}_${path[1]}`)) { | |
rules.push(rule); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fire(); | |
setInterval(fire, 300); | |
setInterval(unfire, 500); | |
function fire() { | |
$('#can').trigger(TRUMP.main.events[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f1DOM = require('f1-dom'); | |
var elButton; | |
var button; | |
// data-f1 defines an association with states | |
// which are later defined when creating an f1 instance | |
document.body.innerHTML = | |
'<div data-f1="elButton">' + | |
'<div data-f1="text">Im a button</div>' + | |
'</div>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f1DOM = require('f1-dom'); | |
var elButton; | |
var button; | |
// data-f1 defines an association with states | |
// which are later defined when creating an f1 instance | |
document.body.innerHTML = | |
'<div data-f1="elButton">' + | |
'<div data-f1="text">Im a button</div>' + | |
'</div>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f1DOM = require('f1-dom'); | |
var elButton; | |
var button; | |
// data-f1 defines an association with states | |
// which are later defined when creating an f1 instance | |
document.body.innerHTML = | |
'<div data-f1="elButton">' + | |
'<div data-f1="text">Im a button</div>' + | |
'</div>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var style = require('dom-css'); | |
var NUM_SAMPLES = 100; | |
var bezier = require('bezier'); | |
var CURVE = [.62,.12,0,1.4]; | |
var x = [ 0, CURVE[0], CURVE[2], 1 ] | |
var y = [ 0, CURVE[1], CURVE[3], 1 ] | |
for(var i = 0; i <= NUM_SAMPLES; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var style = require('dom-css'); | |
var NUM_SAMPLES = 100; | |
var CURVE = [0,1.45,1,-1]; | |
for(var i = 0; i <= NUM_SAMPLES; i++) { | |
var el = document.createElement('div'); | |
style(el, { | |
width: 10, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var red = 0xFF; // 255 | |
var green = 0x10; // 16 | |
var blue = 0xCC; // 204 | |
var alpha = 0xFF; | |
// 24 bit color (no alpha) | |
var color24 = red << 16 | green << 8 | blue; | |
// 32 bit color (alpha) | |
// note >>> 0 if this isn't done alpha overflows to negation bit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* To convert between typed arrays an ArrayBuffer can be used to create | |
* TypedArray's from one type to another. Each typed array has a property | |
* which is an ArrayBuffer. | |
**/ | |
var uint16 = new Uint16Array([0x0102, 0x0304]); | |
var uint32 = new Uint32Array(uint16.buffer); | |
var uint8clamped = new Uint8ClampedArray(uint16.buffer); | |
var uint8 = new Uint8Array(uint16.buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cssTransformToMatrix = require('css-transform-to-mat4'); | |
var containerTest = document.createElement('div'); | |
document.body.style[ 'text-align' ] = 'right'; | |
document.body.style[ 'font-family' ] = 'Helvetica, sans serif'; | |
document.body.style.width = '100%'; | |
document.body.style.height = '100%'; | |
document.body.style.margin = '0'; | |
containerTest.style.height = window.innerHeight + 'px'; |
NewerOlder