boolean redFlag = true; boolean greenFlag = true; boolean blueFlag = true; int myRed = int(random(255)); int myGreen = int(random(255)); int myBlue = int(random(255)); int myWidth = 500; int myHeight = 500; int xLoc = int(random(myWidth)); int yLoc = int(random(myHeight)); int oldXLoc = mouseX; int oldYLoc = mouseY; int newXLoc, newYLoc; //int c = 0; int d = 0; void setup(){ colorMode(RGB, 255); size(myWidth, myHeight); background(0); cursor(CROSS); } void loop(){ if(myRed>=255){ redFlag = false; }else if(myRed<=0){ redFlag = true; } if(myGreen>=255){ greenFlag = false; }else if(myGreen<=0){ greenFlag = true; } if(myBlue>=255){ blueFlag = false; }else if(myBlue<=0){ blueFlag = true; } if(redFlag){ myRed++; }else{ myRed--; } if(greenFlag){ myGreen+=5; }else{ myGreen-=5; } if(blueFlag){ myBlue+=25; }else{ myBlue-=25; } color myColor = color(myRed, myGreen, myBlue); fill (myColor); // noStroke(); stroke(myColor); if(mousePressed == true){ if(d==0){ oldXLoc = mouseX; oldYLoc = mouseY; } //drawMe(); d++; } if (keyPressed){ if(key=='z'){ background(0); } } } void mouseDragged(){ drawMe(); } void mouseReleased(){ d=0; } void drawMe(){ newXLoc = mouseX; newYLoc = mouseY; //int c=1; for(int c=0; c<500; c++){ float rotation = cos(c); rotate(rotation); line(oldXLoc,oldYLoc, newXLoc, newYLoc); //ellipse(newXLoc, newYLoc, 25, 25); smooth(); } //c++; oldXLoc = newXLoc; oldYLoc = newYLoc; }