change the colour of a line and display different shapes

Hi guys,

Having a bit of trouble with Processing and am in need of help! I'm trying to figuring out how to code a mouseOver over each individual line to change its colour after the boolean. In conjunction with that, I also wanted to display a different geometric shape in the centre of the circle (also the same colour as the new line colour)....

Any tips? Thanks!

boolean runonce = false;

void setup () { size (700,700); smooth (); fill (255); background (0); rectMode (CENTER); noStroke (); line (width/2, height/2, 5,5); }

void draw () { background (0); pushMatrix(); stroke (255); translate(50,50); // Circle line (66.98, 75.51, 157.61, 165.84); line (131.95, 59.56, 183.28, 142.26); line (161.7, 57.02, 201.34, 131.11); line (192.18, 62.28, 216.33, 122.88); line (224.91, 75.51, 234.64, 115.66); line (245.15, 12.56, 254.09, 109.47); line (277.44, 29.88, 278.14, 104.65); line (299.79, 32.23, 300, 104.48); line (318.4, 66.98, 315.45, 104.12); line (356.55, 24.76, 340.64, 108.16); line (399.57, 56.46, 373.34, 118.11); line (419.53, 71.52, 389.91, 125.67); line (465.34, 52.84, 404.69, 134.11); line (525.35, 66.98, 435.02, 157.61); line (458.61, 183.28, 541.3, 131.95); line (469.75, 201.34, 543.84, 161.7); line (548.68, 192.18, 477.98, 216.33); line (477.98, 216.33, 548.58, 192.18); line (486.21, 234.64, 525.35, 224.91); line (491.39, 254.09, 588.3, 245.15); line (496.21, 278.14, 570.98, 277.44); line (496.38, 300, 568.63, 299.79); line (495.71, 322.79, 570.48, 323.49); line (490.89, 346.84, 587.8, 355.78);
line (484.71, 366.29, 524.85, 376.02); line (477.48, 384.6, 548.08, 408.74); line (469.25, 399.59, 543.34, 439.23); line (458.11, 417.65, 540.8, 468.98); line (434.52, 443.32, 524.85, 533.95); line (404.19, 466.82, 464.84, 548.09); line (389.41, 475.26, 419.03, 529.41); line (372.84, 482.82, 399.07, 544.47); line (340.14, 492.78, 356.05, 576.17); line (314.95, 496.81, 317.9, 533.95); line (300, 495.74, 299.79, 567.99); line (278.14, 495.57, 277.44, 570.34); line (254.09, 490.75, 245.15, 587.66); line (234.64, 484.57, 224.9, 524.71); line (216.35, 477.34, 192.18, 547.94); line (201.34, 469.11, 161.7, 543.2); line (183.28, 457.91, 131.95, 540.66); line (157.61, 434.38, 66.98, 524.71); line (134.11, 404.6, 52.84, 464.7); line (71.52, 418.89, 125.67, 389.27); line (118.11, 372.7, 56.46, 398.93); line (108.15, 340, 24.76, 355.91); line (104.12, 314.81, 66.98, 317.76); line (104.12, 285.41, 66.98, 282.46); line (108.15, 260.22, 24.76, 244.31); line (118.11, 227.52, 56.46, 201.29); line (125.67, 210.95, 71.52, 181.33); line (134.11, 196.17, 52.84, 135.52); popMatrix();

if ((mouseX == 2) || (mouseX==1)) { runonce = true; ; }

if (runonce) { background (0); pushMatrix(); stroke (255); translate(50,50); line (66.98, 75.51, 157.61, 165.84); line (131.95, 59.56, 183.28, 142.26); line (161.7, 57.02, 201.34, 131.11); line (192.18, 62.28, 216.33, 122.88); line (224.91, 75.51, 234.64, 115.66); line (245.15, 12.56, 254.09, 109.47); line (277.44, 29.88, 278.14, 104.65); line (299.79, 32.23, 300, 104.48); line (318.4, 66.98, 315.45, 104.12); line (356.55, 24.76, 340.64, 108.16); line (399.57, 56.46, 373.34, 118.11); line (419.53, 71.52, 389.91, 125.67); line (465.34, 52.84, 404.69, 134.11); line (525.35, 66.98, 435.02, 157.61); line (458.61, 183.28, 541.3, 131.95); line (469.75, 201.34, 543.84, 161.7); line (548.68, 192.18, 477.98, 216.33); line (477.98, 216.33, 548.58, 192.18); line (486.21, 234.64, 525.35, 224.91); line (491.39, 254.09, 588.3, 245.15); line (496.21, 278.14, 570.98, 277.44); line (496.38, 300, 568.63, 299.79); line (495.71, 322.79, 570.48, 323.49); line (490.89, 346.84, 587.8, 355.78);
line (484.71, 366.29, 524.85, 376.02); line (477.48, 384.6, 548.08, 408.74); line (469.25, 399.59, 543.34, 439.23); line (458.11, 417.65, 540.8, 468.98); line (434.52, 443.32, 524.85, 533.95); line (404.19, 466.82, 464.84, 548.09); line (389.41, 475.26, 419.03, 529.41); line (372.84, 482.82, 399.07, 544.47); line (340.14, 492.78, 356.05, 576.17); line (314.95, 496.81, 317.9, 533.95); line (300, 495.74, 299.79, 567.99); line (278.14, 495.57, 277.44, 570.34); line (254.09, 490.75, 245.15, 587.66); line (234.64, 484.57, 224.9, 524.71); line (216.35, 477.34, 192.18, 547.94); line (201.34, 469.11, 161.7, 543.2); line (183.28, 457.91, 131.95, 540.66); line (157.61, 434.38, 66.98, 524.71); line (134.11, 404.6, 52.84, 464.7); line (71.52, 418.89, 125.67, 389.27); line (118.11, 372.7, 56.46, 398.93); line (108.15, 340, 24.76, 355.91); line (104.12, 314.81, 66.98, 317.76); line (104.12, 285.41, 66.98, 282.46); line (108.15, 260.22, 24.76, 244.31); line (118.11, 227.52, 56.46, 201.29); line (125.67, 210.95, 71.52, 181.33); line (134.11, 196.17, 52.84, 135.52); popMatrix(); }

if (!runonce) { float degree = map(mouseX, 0, width, 0, TWO_PI); degree = constrain (degree,0,TWO_PI); fill (0); noStroke (); arc (width/2, height/2, 680,680,0,degree); }

}

Tagged:

Answers

Sign In or Register to comment.