I hereby claim:
- I am worldoptimizer on github.
- I am maxziebell (https://keybase.io/maxziebell) on keybase.
- I have a public key whose fingerprint is 3CAD 5CF1 89E1 A8C3 A5EF 23E6 B1B4 6EC2 9362 2709
To claim this, I am signing this object:
// Lower value increases trail duration. | |
const CANVAS_CLEANUP_ALPHA = 0.3; | |
// Cleans up the canvas by removing older trails. | |
// ... | |
function cleanCanvas() { | |
// Set 'destination-out' composite mode, so additional fill doesn't remove non-overlapping content. | |
context.globalCompositeOperation = 'destination-out'; | |
// Set alpha level of content to remove. | |
// Lower value means trails remain on screen longer. |
I hereby claim:
To claim this, I am signing this object:
var keyPressLookup = {}; | |
document.addEventListener('keydown', function(e){ | |
keyPressLookup[e.code] = true; | |
}); | |
document.addEventListener('keyup', function(e){ | |
delete keyPressLookup[e.code]; | |
}); |
// fetch scene element and then the lander element in it by classname | |
var sceneElm = document.getElementById(hypeDocument.currentSceneId()); | |
var lander = sceneElm.querySelector('.lander'); | |
var landerBody = hypeDocument.getElementProperty(lander, 'physics-body'); |
function symbolInit (hypeDocument, element, event){ | |
console.log('HypeSymbolInit'); | |
var symbolInstance = hypeDocument.getSymbolInstanceForElement(element); | |
var symbolElement = symbolInstance.element(); | |
switch (symbolInstance.symbolName()){ | |
case 'counter': | |
Object.assign( symbolInstance, { | |
_counter: 0, | |
increase: function(){ |
function symbolInitTest (hypeDocument, element, event){ | |
console.log('HypeSymbolInit'); | |
var symbolInstance = hypeDocument.getSymbolInstanceForElement(element); | |
// do your stuff… | |
} | |
window.HYPE_eventListeners.push({"type":"HypeSymbolInit", "callback":symbolInitTest}); |
.Product-book .book-section .book-cover .cover-spine-overlay img{ | |
width:100%; | |
display:block; | |
-webkit-box-shadow:0 0 16px rgba(0,0,0,0.5); | |
box-shadow:0 0 16px rgba(0,0,0,0.5) | |
} | |
.Product-book .book-section .book-cover .cover-spine-overlay:after{ | |
position:absolute; | |
content:""; | |
width:100%; |
/** | |
* Query intersections between elements using Matter.js | |
* | |
* @param {Node} sourceElm The source element used in each check | |
* @param {Nodelist} targetElms The target elements to query against | |
* @return {Nodelist} Returns a list of targetElms that intersect with sourceElm | |
*/ | |
hypeDocument.queryIntersections = function(sourceElm, targetElms) { | |
var sourceBody = hypeDocument.getElementProperty(sourceElm, 'physics-body'); | |
if (sourceBody) { |
/** | |
* Remove phyics elements from the regular Matter.js collision group | |
* | |
* @param {Nodelist} targetElms The target elements to remove | |
*/ | |
hypeDocument.disablePhysicsCollisions = function(targetElms) { | |
targetElms.forEach(function(elm){ | |
var elmBody = hypeDocument.getElementProperty(elm, 'physics-body'); | |
if (elmBody) elmBody.collisionFilter = { 'group': -1} | |
}); |
if ( hypeDocument.currentDirectionForTimelineNamed(event.timelineName) == hypeDocument.kDirectionForward) { | |
hypeDocument.pauseTimelineNamed(event.timelineName); | |
} |