xxxxxxxxxx
43
let roads = []
let xres = 1
function segment(n, x, w) {
let r = roads[n]
let xrat = r.width/width
let xoff = x*xres
let wid = w*xres
push()
translate(xoff, 0)
image(r, 0,0, wid, height,
sx=xoff*xrat, sy=0, sWidth=wid*xrat, sHeight=r.height)
pop()
}
function preload() {
for (let i=0;i<3;i++) {
roads.push(createVideo(`videos/road${i+1}.mp4`))
roads[i].hide()
roads[i].loop()
}
}
function setup() {
createCanvas(400, 400);
xres = width/3
}
function draw() {
background(220);
let splits = floor(noise(frameCount/100)*10)+1
xres = width/splits
for (let i=0;i<splits;i++) {
let f = floor(noise(frameCount/100)*3)
segment(f, i, 1)
}
}