(p5.dom is now part of p5js, no need to enable if using v0.10+). p5.dom library lets you use video, audio, webcam, input, and text.
Examples: Dom - Video
“In Other Words” by Rachel Clancy
https://openprocessing.org/sketch/448645
License CreativeCommons Attribution ShareAlike
https://creativecommons.org/licenses/by-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
Select the keyboard you wish to use.
CC Attribution ShareAlike
In Other Words
Clancy
xxxxxxxxxx
var flower;
var dial;
var blot;
var displacement = 0;
var oscilate = 0;
var count = 0;
var lastMillis = 0;
var timeDifference = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
imageMode(CENTER);
var col = color(255,255,255,90);
var col2 = color(200,60,40);
var white = color(255,255,255);
textFont('Courier New');
textSize(10);
blotpic = loadImage("https://www.openprocessing.org/sketch/448645/files/a1.png");
flowerpic = loadImage("https://www.openprocessing.org/sketch/448645/files/a2.png");
dialpic = loadImage("https://www.openprocessing.org/sketch/448645/files/a3.png");
ringpic = loadImage("https://www.openprocessing.org/sketch/448645/files/a4.png");
flower = createButton('FLOWER');
flower.position(windowWidth/2-50,height*.28);
flower.mousePressed(flowerpage);
flower.size(100,35);
flower.style("background-color", col);
flower.style("border",col);
flower.style("color",white);
flower.style("outline-color",col2);
flower.style("font-family","Courier New");
flower.style("font-size","18px");
flower.style("letter-spacing","1.5");
dial = createButton('DIAL');
dial.position(windowWidth/2-50,height*.48);
dial.mousePressed(dialpage);
dial.size(100,35);
dial.style("background-color", col);
dial.style("border",col);
dial.style("color",white);
dial.style("outline-color",col2);
dial.style("font-family","Courier New");
dial.style("font-size","18px");
dial.style("letter-spacing","1.5");
blot = createButton('BLOT');
blot.position(windowWidth/2-50,height*.68);
blot.mousePressed(blotpage);
blot.size(100,35);
blot.style("background-color", col);
blot.style("border",col);
blot.style("color",white);
blot.style("outline-color",col2);
blot.style("font-family","Courier New");
blot.style("font-size","18px");
blot.style("letter-spacing","1.5");
ring = createButton('RING');
ring.position(windowWidth/2-50,height*.88);
ring.mousePressed(ringpage);
ring.size(100,35);
ring.style("background-color", col);
ring.style("border",col);
ring.style("color",white);
ring.style("outline-color",col2);
ring.style("font-family","Courier New");
ring.style("font-size","18px");
ring.style("letter-spacing","1.5");
}
function draw() {
background(230,100,80);
timeDifference = millis() - lastMillis;
count+= timeDifference/250.0;
if(count > TWO_PI) count = count % TWO_PI;
oscilate = sin(count);
displacement = map(oscilate, -1,1,-5,5);
push();
translate(width/2,0 + displacement);
image(flowerpic, 0,height*.20,100,100);
image(dialpic, 0,height*.40,100,100);
image(blotpic, 0,height*.60,100,100);
image(ringpic, 0,height*.80,100,100);;
pop();
lastMillis = millis();
}
function flowerpage() {
link("https://www.openprocessing.org/sketch/446093","_new");}
function dialpage() {
link("https://www.openprocessing.org/sketch/445920","_new");}
function blotpage() {
link("https://www.openprocessing.org/sketch/445840","_new");}
function ringpage() {
link("https://www.openprocessing.org/sketch/445587","_new");}
function link(url, winName, options) {
winName && open(url, winName, options) || (location = url);}
p5.dom library lets you use video, audio, webcam, input, and text.
Examples: Dom - Video
See More Shortcuts