Last active
December 24, 2015 08:29
-
-
Save nazrdogan/6770472 to your computer and use it in GitHub Desktop.
Pendulum Processing
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
// x genlik | |
float x= (PI/2); | |
float pos=0; | |
float pos1=0; | |
//float a = atan2(mouseY-height/2, mouseX-width/2); | |
void setup() { | |
size(800, 800); | |
} | |
void draw() { | |
background(255); | |
float a = atan2(mouseY-height/2, mouseX-width/2); | |
if(mousePressed){ | |
translate(width/2, height/2); | |
//float a = atan2(mouseY-height/2, mouseX-width/2); | |
rotate(a-x); | |
pos1=(a-x); | |
stroke(0); | |
println(pos1); | |
//line(-400,0,400,00); | |
//line(0,-400,0,400); | |
// rotate(pos); | |
stroke(0); | |
line(0, 0, 0, 300); | |
fill(0, 133, 200); | |
noStroke(); | |
ellipse(0, 300, 40, 40); | |
} | |
else{ | |
translate(width/2, height/2); | |
// pos = (pos1*cos(millis()/1600.0)); | |
rotate(pos1*cos(millis()/1600.0)); | |
stroke(0); | |
//line(-400,0,400,00); | |
//line(0,-400,0,400); | |
//rotate(pos1*cos(millis()/1600.0)); | |
stroke(0); | |
line(0, 0, 0, 300); | |
fill(0, 133, 200); | |
noStroke(); | |
ellipse(0, 300, 40, 40); | |
println(pos1); | |
} | |
//println(x_pos); | |
//println(y_pos); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment