Advertisement
xeromino

finger

May 10th, 2017
183
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int frms = 500;
  2. float angle;
  3.  
  4. void setup() {
  5.   size(500, 500);
  6.   rectMode(CENTER);
  7. }
  8.  
  9. void draw() {
  10.   background(255);
  11.   float sz = 300;
  12.   translate(width/2, height/2);
  13.   rect(0, 0, sz, sz);
  14.   float x = cos(angle)*sz;
  15.   println(x);
  16.   float px = constrain(x, -sz/2, sz/2);
  17.   float y = sin(angle)*sz;
  18.   float py = constrain(y, -sz/2, sz/2);
  19.   line(0, 0, px, py);
  20.   angle += TWO_PI/frms;
  21. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement