Last active
October 18, 2015 08:54
-
-
Save 0V/7a87d4e717ad9021f727 to your computer and use it in GitHub Desktop.
Processing入門したので対称定規を作ってみた。Processing強力すぎました。協力してくれた @8q に感謝です。
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
void setup(){ | |
size(640,360); | |
background(0); | |
frameRate(60); | |
stroke(120,100,210); | |
} | |
void draw(){ | |
if(mouseButton == LEFT){ | |
int px1 = pmouseX - width / 2; | |
int py = pmouseY - height / 2; | |
int px2 = width/2 - pmouseX; | |
int x1 = mouseX - width / 2; | |
int y = mouseY - height / 2; | |
int x2 = width/2 - mouseX; | |
translate(width/2,height/2); | |
for(int i = 0;i<6;i++){ | |
rotate(60 * PI / 180); | |
line(px1,py,x1,y); | |
line(px2,py,x2,y); | |
} | |
} | |
else if(mouseButton == RIGHT){ | |
clear(); | |
} | |
} |
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
int count = 0; | |
void setup(){ | |
size(640,360); | |
background(0); | |
frameRate(60); | |
} | |
void draw(){ | |
if(mouseButton == LEFT){ | |
int px1 = pmouseX - width / 2; | |
int py = pmouseY - height / 2; | |
int px2 = width/2 - pmouseX; | |
int x1 = mouseX - width / 2; | |
int y = mouseY - height / 2; | |
int x2 = width/2 - mouseX; | |
translate(width/2,height/2); | |
for(int i = 0;i<6;i++){ | |
rotate(60 * PI / 180); | |
line(px1,py,x1,y); | |
line(px2,py,x2,y); | |
} | |
count++; | |
stroke(255 * abs(cos((float)count/200)), 255 * abs(cos((float)count/100)), 255 * abs(sin((float)count/300))); | |
} | |
else if(mouseButton == RIGHT){ | |
clear(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment