Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //made using processing 3.3.6 http://processing.org (Java)
- //after https://www.youtube.com/watch?v=0jjeOYMjmDU
- float fac;
- float angle;
- boolean pause;
- int counter;
- void setup() {
- size(800, 700);
- noSmooth();
- frameRate(120);
- background(0);
- fac = 0.665;
- angle = radians(0);
- pause = false;
- counter = 0;
- }
- void draw() {
- String file = "frames/####.tif";
- saveFrame(file);
- counter += 1;
- if (!pause) {
- background(0);
- if ( degrees(angle) >= 360 ) {
- angle = 0;
- exit();
- }
- angle += 0.01;
- float f = (float)((int)(degrees(angle) * 10)) / 10;
- textSize(20);
- fill(255);
- text(f + "°", 10, 60);
- translate(width/2, height);
- stroke(255);
- branch(height/3);
- }
- }
- void branch(float len) {
- if (len >= 1) {
- line(0, 0, 0, -len);
- translate(0, -len);
- pushMatrix();
- rotate(angle);
- branch(len * fac);
- popMatrix();
- pushMatrix();
- rotate(-angle);
- branch(len * fac);
- popMatrix();
- }
- }
- void mousePressed() {
- if ( pause ) {
- pause = false;
- } else {
- pause = true;
- }
- }
- //inspired by https://www.youtube.com/watch?v=0jjeOYMjmDU
Advertisement
Add Comment
Please, Sign In to add comment