xxxxxxxxxx
32
const leadingZero = (string, minLength) => {
if (typeof string === 'number') string = `${string}`
const padding = minLength - string.length
if (padding > 0) string = '0'.repeat(padding) + string
return string
}
const SEQUENCE_COUNT = 199
let sequenceImgs = Array(SEQUENCE_COUNT).fill(0)
const notLoaded = Array(SEQUENCE_COUNT).fill(0).map((_,i) => i)
window.preload = () => {
for (let i = 0; i < SEQUENCE_COUNT; i++) {
const path = `data/${leadingZero(i + 1, 4)}.png`
loadImage(path, () => {
console.log(path, notLoaded.filter(l => l !== false))
notLoaded[i] = false
}, console.error)
}
}
window.setup = () => {
createCanvas(500, 500)
console.log('setup')
}
window.draw = () => {
}