/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.GDtRDplszON/rev.290
*
* authors:
* Dennis Daniels
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
//
/*
found http://openprocessing.org/visuals/?visualID=20257
made by Christopher Roche
http://openprocessing.org/portal/?userID=9641
ideas:
add random colors
put blackhole background
randomize ellipses (like planets) to show a 'black hole' in action
put a black hole in the middle
*/
//declare variables at the top
float Tick = 0; // gets incremented every frame
float Rotation = 0.01;
float RotationalSpeed = 0.001;
float RotationalAccel = 0.0001; // Acceleration
float Scale = 1;
//initialize program
void setup() {
size(800,800);
background(0);
smooth();
colorMode(RGB);
fill(color(255,190,70)); // Change intial color
}
//initiate function
void draw() {
++Tick;
translate(width/2, height/2); //have the rotation and scale in the middle
Rotation += (RotationalSpeed += RotationalAccel); // Accelerate the Rotation
rotate(Rotation);
Scale = 1+sin(Tick/15); //Calculate the scale
if (Scale<.01) { // Is it a new Cycle?
fill(color(Scale,44,Scale)); // Change color//be cool if it was random
}
scale(.4*Scale); // Scale it with the sin equasion but keep it in the screen
// Adjust Border thickness for scaling (remove if run in the API)
translate(-width/2, -height/2); //Translate back
DrawShape();
}
void DrawShape() {
ellipse(width/18,height/12,width/8,height/8);//change for amusement
fill (255,0,0);
rect(width/12,height/12,width/8,height/8);//change for amusement
if (mousePressed == true) {
fill(mouseX,mouseY,222);
} else {
fill(255,171,3);
}
//
//why doesn't this work?
//void mousePressed(){
// save("image.png");//produces a png
// }
}