Interactive Authoring Moving Shapes

screen-shot-2016-09-08-at-11-33-53-pm

The above image is a still of an animation programmed in Processing 3. The code is copied below.


float rB = 123;
float gB = 255;
float bB = 0;
float rC = 255;
float gC = 255;
float bC = 255;
float rT = 0;
float gT = 0;
float bT = 0;
float rR = 123;
float gR = 123;
float bR = 123;
float circleX = 0;
float circleY = 0;
float circleW = 50;
float circleH = 100;
float circleStroke = 255;
float backgroundColor = 255;
float change1 = 0.5;
float change2 = 1.0;
float change3 = 3.0;
float rectA = 720;
float rectB = 0;
float rectC = 770;
float rectD = 75;
float rectR = 90;
float triangleX1 = 50;
float triangleY1 = 400;
float triangleX2 = 100;
float triangleY2 = 480;
float triangleX3 = 0;
float triangleY3 = 480;
// Your basic setup
void setup() {
size(720, 480);
smooth();
}
void draw() {
// Draw the background and the ellipse
background(rB, gB, bB);
rB = rB + change2;
gB = gB – change1;
bB = bB + change2;

stroke(circleStroke);
fill(rT,gT,bT);
triangle(triangleX1,triangleY1,triangleX2,triangleY2,triangleX3,triangleY3);
triangleX1 = triangleX1 + change3;
triangleY1 = triangleY1 – change2;
triangleX2 = triangleX2 + change1;
triangleY2 = triangleY2 – change3;
triangleX3 = triangleX3 + change1;
triangleY3 = triangleY3 – change2;
rT = rT + change1;
gT = gT + change2;
bT = bT + change3;

stroke(circleStroke);
fill(rC,gC,bC);
ellipse(circleX, circleY, circleW, circleH);
circleX = circleX + change1;
circleY = circleY + change2;
circleW = circleW + change1;
circleH = circleH – change1;
circleStroke = circleStroke – change1;
rC = rC – change3;
gC = gC – change1;
bC = bC – change2;

stroke(circleStroke);
fill(rR,gR,bR);
rect(rectA, rectB, rectC, rectD, rectR);
rectA = rectA – change1;
rectB = rectB + change2;
rectC = rectC + change3;
rectD = rectD + change1;
rectR = rectR – change1;
rR = rR – change1;
gR = gR + change1;
bR = bR – change1;

}

Advertisements
This entry was posted in Interactive Authoring and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s