String gridName = "Waffles"; float rand = 255; float r = random(256); float a = 0.0; float inc = TWO_PI/5.0; int x = 0; void setup() { size(700, 700); stroke(255, 0, 0); frameRate(30); println(" The inc = " + inc); for (int i=0; i < height; i+=20) { fill(0, 255, 0); rect(0, i, width, 10); fill(160, 10, 200); rect(i, 0, 10, height); } stroke(200, 100, 50); for (int b = 5; b < 700; b += 5) { if (b < 35) { line( 30, r, 700, b ); } else { line( 20, b, 700, r ); } } strokeWeight(7); stroke(0, 255, 255); for (int w=0; w< 700; w+=10) { line(w, 300, w, 300+sin(a)*200.0); println(" The angle = " + a + "The sin = " + sin(a)); a = a + inc; } } void draw() { for (int s = 0; s < 700; s += 20) { for (int j = 0; j < 700; j += 20) { noStroke(); fill(random(255), random(255), random(255), random(255)); ellipse( s, j, 10, 10 ); println(gridName + ", now has a fill value of " + random(255), random(255), random(255)); if (mousePressed) { ellipse(s, j, 30, 30); } } } strokeWeight(1); stroke(255); fill(random(255)); rect(mouseX, mouseY, 50, 50, random(255)); if (mousePressed) { strokeWeight(1); stroke(255); fill(random(255), random(255), random(255)); rect(mouseX, mouseY, 50, 50, random(255)); } if (x < 500) { line(x, 0, x, 100); x = x + 3; } else { noLoop(); exit(); } saveFrame("line-####.png"); }
First sketch made in Processing.
In this sketch, I was still getting used working with Processing and how different functions worked. I used the sin function and grid and added randomness to make the animation more colorful.
int value = 0; int tCounter = 0; PImage b; PFont f; int x = 0; void setup() { size(800, 800); noStroke(); rectMode(CENTER); b = loadImage("2corgi.jpg"); image(b, 0, 0, width, height); } void draw() { background(255-value); fill(value); ellipse(width/2, height/2, 400, 400); fill(value); rect(200, 400, 50, tCounter); fill(value); rect(600, 400, 50, tCounter); for ( int value = 0; value < width; value += 32 ) { fill(mouseX, mouseY, 100, 100); rect(value, height/4, 20, height); tint(255, 50); image(b, mouseX, mouseY); } value++; if ( value > 255) { value = 0; } fill(value, 204); rect(mouseX, height/2, mouseY/2+10, mouseY/2+5); fill(value, 204); //printArray(PFont.list()); f = createFont("Century Gothic", 48); textFont(f); if ( mousePressed && keyPressed == true ) fill(0, random(255), random(255)); text("Send Help", 120, tCounter); tCounter ++; if (tCounter > width) { tCounter = -10; } fill(50, 30); rect(0, 0, width, height); textAlign(CENTER); myDrawType("Hello", mouseX, 200); circle(width*1, height*0.5, 200, 10); circle(width*0, height*0.5, 200, 10); circle(width*0.5, height*1, 200, 10); circle(width*0.5, height*0, 200, 10); if (x < 900) { line(x, 0, x, 1); x = x + 1; } else { noLoop(); exit(); } saveFrame("line-#####.png"); } void circle(float lox, float loy, int size, int x) { float a = size/x; for (int i = 0; i < x; i++) { fill(random(255),random(255),random(255)); ellipse(lox, loy, size - i*a, size - i*a); } } void keyPressed() { if ( key == 'b' || key == 'B' ) { // example of toggle logic stroke(1); strokeWeight(3); line(mouseX, mouseY, pmouseX, pmouseY); } else { stroke(6); strokeWeight(10); } } void mouseMoved() { value = value + 1; if (value > 255) { value = 0; } } //void ssSign1(String ss , int locx, int loy) { // fill(120,50); // rect(locx,loy,300,50); // fill(34); // rect(locx-10,loy-10,300,50); // color k = color(0,255,255); // ssDrawText(ss,locx+5,loy+20,k); // ssRanGrcs(locx,loy,color(110,118,179,30)); //} void ssDrawText(String s, int lx, int ly, color c ) { fill(c); text(s, lx, ly,20); } void ssRanGrcs(int lx, int ly, color c) { fill(c); float r = random(250); for (int i= 0; i < 150; i++) { ellipse(lx-r,ly-r,20,20); } } void myDrawType(String s, int x, int y ) { fill(255, 0, 0); text(s, x, y); fill(200); rect(x, y, 5, 5); }
In this sketch, I made custom functions to create the rainbow circles on the edges of the video. I also added an image that fills the whole sketch. I also used text and played with different stroke weights.
int x = 0; char currentkey = '1'; color bgc = color(255); void setup() { size(900, 900); background(255); smooth(); } void draw() { // triggering the clear_print function if(keyPressed) { clear_print(); } // triggering the newkeychoice if(mousePressed) { drawChoice(); } //if (x < 1000) { // line(x, 0, x, 1); // x = x + 1; //} else { // noLoop(); // exit(); //} // saveFrame("newline-####.jpg"); } void drawChoice() { // the key mapping if statemens that you can change to do anything you want. // just make sure each key option has the a stroke or fill and then what type of // graphic function // key global variable contains whatever key was last pressed char currentkey = key; switch(currentkey) { case '1': println("1"); // black line drawline(color(0), mouseX, mouseY, pmouseX, pmouseY); break; case '2': //println("2"); // rainbow line //strokeWeight(5); //drawline(color(random(255),random(255),random(255),random(255)), mouseX, mouseY, pmouseX, pmouseY); noStroke(); // blue circle fill(0,0,random(255)); ellipse(mouseX, mouseY, 100, 100); break; case '3': println("2"); // green circle noStroke(); fill(0, random(255),0); ellipse(mouseX, mouseY, 100, 100); break; case '4': // println("2"); // red circle //fill(random(255),random(255),random(255)); // stroke(random(255), random(255), random(255)); // triangle(mouseX, mouseY, 350, 350, 20, 20); noStroke(); fill(random(255),0,0); ellipse(mouseX,mouseY,100,100); break; case '5': // rainbow circle //drawline(color(random(255)), mouseX, mouseY,pmouseX, pmouseY); noStroke(); fill(random(255),random(255),random(255)); ellipse(mouseX, mouseY, 100,100); break; case '6': //grayscale circle noStroke(); fill(random(255)); ellipse(mouseX, mouseY, 100,100); break; case '7': strokeWeight(6); drawline(color(random(255)), mouseX, mouseY,pmouseX, pmouseY); break; case '8': strokeWeight(6); drawline(color(random(255),0,0), mouseX, mouseY,pmouseX, pmouseY); break; case '9': strokeWeight(6); drawline(color (0,random(255),0), mouseX, mouseY,pmouseX, pmouseY); break; case '0': strokeWeight(6); drawline(color(0,0,(random(255))), mouseX, mouseY,pmouseX, pmouseY); break; case 'q': strokeWeight(6); drawline(color(random(255),random(255),random(255)), mouseX, mouseY,pmouseX, pmouseY); break; case 'w': noStroke(); fill(random(255)); rect(mouseX,mouseY,10,10); break; case 'r': noStroke(); fill(random(255),0,0); rect(mouseX,mouseY,10,10); break; case 't': noStroke(); fill(0,random(255),0); rect(mouseX,mouseY,10,10); break; case 'y': noStroke(); fill(0,0,random(255)); rect(mouseX,mouseY,10,10); break; case 'u': noStroke(); fill(random(255),random(255),random(255)); rect(mouseX,mouseY,10,10); break; case 'e': println("2"); // erase with bg color fill(255); eraser(bgc,mouseX, mouseY,25); break; default: // Default executes if the case labels println("None"); // don't match the switch parameter break; } } void drawline(color k, int lx,int ly, int px,int py) { // strokeWeight(1); stroke(k); line(lx, ly, px, py); } void drawFatLine(color k, int lx,int ly, int px,int py) { strokeWeight(10); stroke(k); line(lx, ly, px, py); } void eraser(color k,int lx,int ly,int sz) { stroke(k); ellipse(lx, ly, sz,sz); } void clear_print() { // these 2 options let you choose between clearing the background // and saveing the current image as a file. if (key == 'x' || key == 'X') { background(255); } else if (key == 'p' || key == 'P') { saveFrame("x_xxx_####.png"); //this will save the name as the intials and a random counting number. // it will always be larger in value then the last one. delay(500); } }
For my drawing tool, I made different tools using randomness and RGB. I wanted to make it so that every time you draw something it will always
look slightly different due to the unpredicability of the tools. Lines, ellipses, and squares can be made with this tool. The color options are red,
green, blue, grayscale, and rainbow colors.
1: Black Pen | 2: blue circles | 3: green circles | 4: red circles | 5: rainbow circles | 6: grayscale circles | 7: grayscale line | 8: red line | 9: green line | 0: blue line | q: rainbow line | w: grayscale squares | r: red squares | t: green square | y: blue squares | u: rainbow square