Initial Commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Continuous Lines.
|
||||
*
|
||||
* Click and drag the mouse to draw a line.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(102);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
stroke(255);
|
||||
if (mousePressed == true) {
|
||||
line(mouseX, mouseY, pmouseX, pmouseY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Patterns.
|
||||
*
|
||||
* Move the cursor over the image to draw with a software tool
|
||||
* which responds to the speed of the mouse.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(102);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
// Call the variableEllipse() method and send it the
|
||||
// parameters for the current mouse position
|
||||
// and the previous mouse position
|
||||
variableEllipse(mouseX, mouseY, pmouseX, pmouseY);
|
||||
}
|
||||
|
||||
|
||||
// The simple method variableEllipse() was created specifically
|
||||
// for this program. It calculates the speed of the mouse
|
||||
// and draws a small ellipse if the mouse is moving slowly
|
||||
// and draws a large ellipse if the mouse is moving quickly
|
||||
|
||||
void variableEllipse(int x, int y, int px, int py) {
|
||||
float speed = abs(x-px) + abs(y-py);
|
||||
stroke(speed);
|
||||
ellipse(x, y, speed, speed);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Pulses.
|
||||
*
|
||||
* Software drawing instruments can follow a rhythm or abide by rules independent
|
||||
* of drawn gestures. This is a form of collaborative drawing in which the draftsperson
|
||||
* controls some aspects of the image and the software controls others.
|
||||
*/
|
||||
|
||||
int angle = 0;
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(102);
|
||||
noStroke();
|
||||
fill(0, 102);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
// Draw only when mouse is pressed
|
||||
if (mousePressed == true) {
|
||||
angle += 5;
|
||||
float val = cos(radians(angle)) * 12.0;
|
||||
for (int a = 0; a < 360; a += 75) {
|
||||
float xoff = cos(radians(a)) * val;
|
||||
float yoff = sin(radians(a)) * val;
|
||||
fill(0);
|
||||
ellipse(mouseX + xoff, mouseY + yoff, val, val);
|
||||
}
|
||||
fill(255);
|
||||
ellipse(mouseX, mouseY, 2, 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user