xxxxxxxxxx
37
// Ignore the initial error: TypeError: Cannot read properties of undefined (reading '_report'); the web editor is expecting the p5.js lib to be loaded normally
//
// Build last updated: Aug 30, shader-filters branch
function preload() {
font = loadFont('CommitMono VariableFont.ttf')
video = createVideo('bbb_trimmed_muted_resized.mp4')
}
function setup() {
video.hide()
video.loop()
createCanvas(640, 360, WEBGL)
label = 'filter(BLUR)'
textSize(30)
textFont(font)
lblWidth = textWidth(label) + 20
lblHeight = textAscent() + 20
}
function draw() {
clear()
image(video, -width/2, -height/2)
filter(BLUR, 5)
fill('WHITE')
noStroke()
rect(-width/2, height/2 - lblHeight, lblWidth, lblHeight)
fill('BLACK')
text(label, -width/2 + 10, height/2 - 10)
}
function keyPressed() {
video.play()
}