“My Sketch” by Kate Lockett
https://openprocessing.org/sketch/2217321
License CreativeCommons Attribution NonCommercial ShareAlike
https://creativecommons.org/licenses/by-nc-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!
CC Attribution NonCommercial ShareAlike
My Sketch
Lockett
xxxxxxxxxx
var diam=10;
var diamspeed=10;
var x=0;
var xspeed=5;
var x2=500;
var x2speed=-5;
var y2=0;
var y2speed=5;
var x3=0;
var x3speed=5;
var y3=500;
var y3speed=-5;
var x4=500;
var x4speed=-5;
var y4=500;
var y4speed=-5;
var sq=10;
var sqspeed=5;
var l1=500;
var l2=500;
var l1speed=-10;
var l2speed=-10;
function setup(){
createCanvas(1000,1000);
background(0);
}
function draw(){
scale(2);
fill(0,10);
rect(0,0,width,height);
diam=diam+diamspeed;
noStroke();
fill(80,90,150);
circle(250,250,diam);
if(diam>400 || diam<10){
diamspeed=diamspeed*-1;
}
x=x+xspeed;
x2=x2+x2speed;
y2=y2+y2speed;
strokeWeight(1);
stroke(0,30,100);
fill(10,50,70);
//top left
triangle(0,0,x,x,0,50);
//top right
triangle(500,0,x2,y2,500,50);
if (x>200 || x<0){
xspeed=xspeed*-1;
}
if (x2<300 || x2>500){
x2speed=x2speed*-1;
}
if(y2>200 || y2<0){
y2speed=y2speed*-1;
}
//bottom left
triangle(0,450,x3,y3,0,500);
x3=x3+x3speed;
y3=y3+y3speed;
if(x3>200 || x3<0){
x3speed=x3speed*-1;
}
if(y3<300 || y3>500){
y3speed=y3speed*-1;
}
//bottomright
triangle(500,450,x4,y4,500,500);
x4=x4+x4speed;
y4=y4+y4speed;
if(x4<300 || x4>500){
x4speed=x4speed*-1;
}
if(y4<300 || y4>500){
y4speed=y4speed*-1;
}
strokeWeight(2);
stroke(0);
fill(40,70,140,20);
square(0,0,sq);
sq=sq+sqspeed;
if(sq>500 || sq<0){
sqspeed=sqspeed*-1;
}
strokeWeight(5);
stroke(60,30,150,60);
line(500,500,l1,l2);
l1=l1+l1speed;
l2=l2+l2speed;
if (l1<0 || l1>500){
l1speed=l1speed*-1;
}
if(l2<0 || l2>500){
l2speed=l2speed*-1;
}
}
See More Shortcuts