Interactive Authoring: Project 2

capture

The image shown is a still shot taken of an animation done in Processing. The code for the animation is as follows.

float circleX = 0;
float circleY = 0;
float circleW = 50;
float circleH = 100;
float circleStroke = 255;
float circleFill = 0;
float backgroundColor = 255;
float change = .5;

float MilkX = 200;
float MilkY = 120;
float MilkW = 100;
float MilkH = 75;
float MilkStroke = 255;
float MilkFill = 0;
float MilkColor = 255;
float Milk = .25;

float RectX = 58;
float RectY = 94;
float RectW = 75;
float RectH = 54;
float RectStroke = 197;
float RectFill = 0;
float RectColor = 178;
float Rect = 1.0;

float triA = 20;
float triB = 68;

float triC = 123;
float triD = 385;

float triE = 135;
float triF = 55;

float animate = 1.25;

// Your basic setup
void setup() {
size(720,480);
smooth();
}
void draw() {
// Draw the background and the ellipse
background(backgroundColor);
stroke(circleStroke);
fill(circleFill);
ellipse(circleX,circleY,circleW,circleH);
// Change the values of all variables
circleX = circleX + change*2;
circleY = circleY + change/2;
circleW = circleW + change;
circleH = circleH – change;
circleStroke = circleStroke – change;
circleFill = circleFill + change;

stroke(MilkStroke);
fill(MilkFill);
rect(MilkX,MilkY,MilkW,MilkH);
// Change the values of all variables
MilkX = MilkX + Milk;
MilkY = MilkY + Milk;
MilkW = MilkW + Milk;
MilkH = MilkH – Milk;
MilkStroke = MilkStroke – Milk;
MilkFill = MilkFill + Milk;

stroke(RectStroke);
fill(RectFill);
rect(RectX,RectY,RectW,RectH);
// Change the values of all variables
RectX = RectX + Rect;
RectY = RectY + Rect;
RectW = RectW + Rect;
RectH = RectH – Rect;
RectStroke = RectStroke – Rect/2;
RectFill = RectFill + Rect;

stroke(0,55,138);
fill(0,10,86);
triangle(triA,triB,triC,triD,triE,triF);

triA = triA + animate;
triB = triB + animate;
triC = triC + animate;
triD = triD + animate;
triE = triE + animate;
triF = triF + animate;
}

Advertisements
This entry was posted in Time-Based 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