hi!
i just write this code. at the moment it draws the "wheel spokes" in irregular gaps. i hope there is a possibility to add steps. for example every 15° a spoke. i really want to end the dependence on the framerate!
this is my code:
- void setup()
- {
- size(1000,1000);
- stroke(20);
- smooth();
- frameRate(200);
- rect(490,90,20,20);
- }
- void draw()
- {
- int posX = 500 - mouseX;
- if (posX < 0) {
- posX = 0 - posX;
- }
- int posY = 500 - mouseY;
- if (posY < 0) {
- posY = 0 - posY;
- }
- float a2 = sq(posX);
- float b2 = sq(posY);
- float c2 = sqrt(a2 + b2);
- int c22 = (int)c2;
- if(mousePressed) {
- stroke(180);
- line(500, 500, mouseX, mouseY);
- stroke(204, 102, 0);
- line(pmouseX, pmouseY, mouseX, mouseY);
- println(c22);
- }
- }
1