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
function autoplayVideoSupported(muted = true, playsinline = true) { | |
const v = document.createElement('video') | |
v.muted = muted | |
playsinline && v.setAttribute('playsinline', 'playsinline') | |
v.setAttribute('width', 0) | |
v.setAttribute('height', 0) | |
v.style.opacity = 0 | |
document.querySelector('body').appendChild(v) | |
return new Promise((resolve, reject) => { | |
v.play() |
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
const createUVWGrid = ([cx, cy, cz]) => { | |
return times(cx).map(x => times(cy).map((y) => times(cz).map(z => | |
new THREE.Vector3( | |
cx <= 1 ? 0.5 : x / (cx - 1), | |
cy <= 1 ? 0.5 : y / (cy - 1), | |
cz <= 1 ? 0.5 : z / (cz - 1) | |
) | |
))).flat(2) | |
} |
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
import React from 'react' | |
const ScrollContext = React.createContext(null) | |
export function useScroll() { | |
const scroll = React.useContext(ScrollContext) | |
if (!scroll) | |
throw new Error('Please make sure ScrollContextProvider is available') | |
return scroll |
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
[ | |
{ | |
"from": { | |
"pos": [ | |
153.43916, | |
-29.50063 | |
], | |
"time": "2021-10-03 07:26:23" | |
}, | |
"to": { |
OlderNewer