This file contains hidden or 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
let totalSize = 0; | |
for (let key in localStorage) { | |
if (localStorage.hasOwnProperty(key)) { | |
let keySize = new Blob([key]).size; // Size of the key | |
let valueSize = new Blob([localStorage[key]]).size; // Size of the value | |
totalSize += keySize + valueSize; | |
} | |
} |
This file contains hidden or 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
declare module 'virtual-scroll' { | |
export type VirtualScrollEvent = { | |
x: number // total distance scrolled on the x axis | |
y: number // total distance scrolled on the y axis | |
deltaX: number // distance scrolled since the last event on the x axis | |
deltaY: number // distance scrolled since the last event on the y axis | |
originalEvent: Event // the native event triggered by the pointer device or keyboard | |
} | |
export type VirtualScrollCallback = (e: VirtualScrollEvent) => void |
This file contains hidden or 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
vec2 uvCover (vec2 uv, vec2 size, vec2 resolution) { | |
vec2 coverUv = uv; | |
vec2 s = resolution; // Screen | |
vec2 i = size; // Image | |
float rs = s.x / s.y; | |
float ri = i.x / i.y; | |
vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x); | |
vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new; | |
This file contains hidden or 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 material = new THREE.MeshStandardMaterial({ | |
map: new THREE.TextureLoader().load('map.jpg'), | |
normalMap: new THREE.TextureLoader().load('normalMap.jpg') | |
}); | |
const loader = new THREE.JSONLoader(); | |
loader.load('geometry.json', geometry => { | |
const mesh = new THREE.Mesh(geometry, material); | |