Created
March 30, 2020 05:40
-
-
Save calleufuzi/b324264afc2e5569107ed54d9d2272aa to your computer and use it in GitHub Desktop.
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
let video; | |
const windowWidth = window.innerWidth; | |
const windowHeight = window.innerHeight; | |
function setup() { | |
createBg(); | |
canvas = createCanvas(windowWidth, windowHeight, WEBGL); | |
clear(); | |
canvas.position(0, 0); | |
canvas.id("p5Canvas"); | |
canvas.parent("container"); | |
video = createCapture(VIDEO, videoReady); | |
video.size(640, 480); | |
video.id("p5Video"); | |
video.hide(); | |
} | |
function draw() {} | |
function videoReady() { | |
const seriously = new Seriously({}); | |
const reformat = seriously.transform("reformat"); | |
const src = seriously.source("#p5Video"); | |
const target = seriously.target("#p5Canvas"); | |
reformat.width = target.width; | |
reformat.height = target.height; | |
reformat.mode = "width"; | |
const chroma = seriously.effect("chroma"); | |
chroma.source = src; | |
reformat.source = chroma; | |
target.source = reformat; | |
seriously.go(); | |
} | |
function createBg() { | |
let img = createImg("./angular.png"); | |
img.parent("container"); | |
img.id("bg"); | |
img.size(windowWidth, windowHeight); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment