4o2o
YaBB Newbies
Offline
Posts: 8
Re: simple ellipse rotate z axis
Reply #9 - Jun 30th , 2009, 12:19am
I modified the code with a few more variables colorwheel (just a few colors) and the code syntax collapses. int segs = 6; int steps = 1; float rotAdjust = radians (360.0/segs/2.0); float radius = 95.0; float segWidth = radius/steps; float interval = TWO_PI/segs; int SHADE = 0; int TINT =1; float angleInDegrees = 42; void setup() { size(256,256); ellipseMode(CENTER); } void draw() { background(128); pushMatrix(); //start drawing from mouse position translate(mouseX, mouseY); createWheel(width/2, height/2, SHADE); } void createWheel (int x, int y, int valueshift) { if (valueshift ==SHADE){ for (int j=0; j<steps; j++){ color []cols = { color(255-(255/steps)*j, 255-(255/steps)*j, 0), color(255-(255/steps)*j, (255/1.5)-((255/1.5)/steps)*j, 0), color(255-(255/steps)*j, (255/2)-((255/2)/steps)*j, 0), color(255-(255/steps)*j, (255/2.5)-((255/2.5)/steps)*j, 0), color(255-(255/steps)*j, 0, 0), color(255-(255/steps)*j, 0, (255/2)-((255/2)/steps)*j), color(255-(255/steps)*j, 0, 255-(255/steps)*j), color((255/2)-((255/2)/steps)*j, 0, 255-(255/steps)*j), color(0, 0, 255-(255/steps)*j), color(0, 255-(255/steps)*j, (255/2.5)-((255/2.5)/steps)*j), color(0, 255-(255/steps)*j, 0), color((255/2)-((255/2)/steps)*j, 255-(255/steps)*j, 0) }; for (int i=0; i< segs; i++){ fill(cols[i]); arc(x, y, 0, 0, interval*i+rotAdjust, interval*(i+1)+rotAdjust); } radius -= segWidth; } } //0,0 because the origin was moved to the mouse popMatrix (); } angleInDegrees += 2; } as soon as I modify the code the syntax collapses rather than complexity of code bugs some of the code was missing and the line that has an error is createWheel (width/2, height/2, SHADE);