Advertisement
Guest User

Untitled

a guest
Nov 8th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.86 KB | None | 0 0
  1. int wheelR = 300;
  2. float turn = 5;
  3. float rotation;
  4.  
  5. void setup() {
  6.   size(600,600);
  7.   frameRate(24); //the rate the camera takes pictures at
  8.   textAlign(CENTER);
  9.   ellipseMode(CENTER);
  10.   strokeWeight(20);
  11. }
  12.  
  13. void draw() {
  14.   fill(255);
  15.   background(0);
  16.   rotation = frameCount / turn;
  17.   println(rotation);
  18.   pushMatrix();
  19.   translate(width/2, height/2);
  20.   rotate(rotation * TWO_PI);
  21.   ellipse(0,0, wheelR*2, wheelR*2);
  22.   //draws the fist spoke in a different color (comment out for real-life setting)
  23.   for (int i = 0; i < 5; i++) {
  24.     if (i == 0) {
  25.       stroke(255, 0, 200);
  26.     } else {
  27.       stroke(0);
  28.     }
  29.     line(0, 0, 0, -wheelR); //draws the first spoke upwards
  30.     rotate(TWO_PI*1/5);
  31.   }
  32.   popMatrix();
  33.   textSize(33);
  34.   text("1/"+ int(turn), 63, 33);
  35.   text(frameCount % 24, width-63, 33);
  36. }
  37.  
  38. void mousePressed() {
  39.   turn++;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement