“homework_classes” by Veronica Black
https://openprocessing.org/sketch/70140
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!
CC Attribution ShareAlike
Archived Sketch
This sketch is created with an older version of Processing,
and doesn't work on browsers anymore.
View Source Code
homework_classes
Black
xxxxxxxxxx
//Homework "Star" by Veronica Black for CCLab F'12
//Using a class with function and Pop/Push Matrix
//POP+PUSH Matrix
float size = 100;
int r, g, b, o, y, w, p, t, s;
/*red*//*green*//*blue*//*orange*//*yellow*//*white*//*pink*//*teal*//*silly*/
//Object of my class
star myStar;
star myStar2;
star myStar3;
star myStar4;
void setup(){
size(600, 600);
noStroke();
myStar = new star();
myStar2 = new star();
myStar3 = new star();
myStar4 = new star();
r = 255;
g = 0;
b = 100;
o = 255;
y = 0;
w = 100;
p = 255;
t = 0;
s = 100;
}
void draw(){
//pop+push
if(frameCount % 10 == 0) {
fill(r, g, b, 10);
pushMatrix();
translate(width/2, height/2); // can be any size
rotate(radians(frameCount * 2 % 360));
rect(0, size, size/2, 0, size, size/2);
popMatrix();
size += 0.15;
r --; //r ++; //why -- or ++
g ++;
b ++;
}
if(frameCount % 10 == 0) {
fill(o, y, w, 25);
pushMatrix();
translate(width/4, height/4); // can be any size
rotate(radians(frameCount * 2 % 360));
rect(0, size, size/2, 0, size, size/2);
popMatrix();
size += 0.25;
o ++; //r ++; //why -- or ++
y ++;
w ++;
}
if(frameCount % 10 == 0) {
fill(p, t, s, 50);
pushMatrix();
translate(height, width/2); // can be any size
rotate(radians(frameCount * 2 % 360));
rect(0, size, size/2, 0, size, size/2);
popMatrix();
size += 0.25;
p ++; //r ++; //why -- or ++
t ++;
s ++;
}
//class
myStar.move();
myStar.display();
myStar2.move();
myStar2.display();
myStar3.move();
myStar3.display();
myStar4.move();
myStar4.display();
}
See More Shortcuts