Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var capture;
- var frame;
- function setup() {
- createCanvas(600, 450);
- capture = createCapture(VIDEO);
- capture.size(width, height);
- capture.hide();
- frame = loadImage("frame.png"); //you need a local image that is your frame border
- }
- function draw() {
- background(255);
- image(capture, 0, 0, width, height);
- if (keyIsPressed) { //uses MaKey MaKey so limited input
- if (keyCode == UP_ARROW) colorize();
- if (keyCode == LEFT_ARROW) filter(POSTERIZE, 5);
- if (keyCode == RIGHT_ARROW) filter(INVERT);
- if (keyCode == DOWN_ARROW) showText();
- if (key === ' ') image(frame,0,0,width,height);
- }
- }
- function showText() {
- fill(255, 255, 0, 150);
- textSize(150);
- textAlign(CENTER);
- text("COOL", width/2, height / 2);
- }
- function colorize() {
- fill(0,0,255,100);
- rect(0,0,width,height);
- }
- function mouseReleased() {
- save("photobooth.png");
- }
Advertisement
Add Comment
Please, Sign In to add comment