Created
April 26, 2019 23:39
-
-
Save noelyahan/50440f67d61a19f1cffd07827fcaa762 to your computer and use it in GitHub Desktop.
This processing sketch will provide a scale up down transition for rectangle and circle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Scale | |
* by Denis Grutze. | |
* | |
* modified by Noel. | |
* | |
* Paramenters for the scale() function are values specified | |
* as decimal percentages. For example, the method call scale(2.0) | |
* will increase the dimension of the shape by 200 percent. | |
* Objects always scale from the origin. | |
*/ | |
float a = 0.0; | |
float s = 0.0; | |
float m = 0.0; | |
void setup() { | |
size(1280, 720); | |
noStroke(); | |
rectMode(CENTER); | |
frameRate(30); | |
} | |
void draw() { | |
background(255); | |
a = a + 0.04; | |
s = cos(a)*2; | |
m = map(s, 0, 100, 0, width); | |
translate(width/2, height/2); | |
scale(m); | |
fill(0); | |
//ellipse(0,0,150,150); | |
rect(0, 0, 150, 150); | |
//saveFrame("img-######.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment