-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
float xh = 70; | ||
float yh = 70; | ||
float xo = 255; | ||
float yo = 55; | ||
|
||
void setup() { | ||
size(300, 300); | ||
} | ||
|
||
void draw() { | ||
background(255, 0, 0); | ||
line(xh, yh, xo, yo); | ||
float xf = xh + (xo - xh)/5; | ||
float yf = yh + (yo - yh)/5; | ||
ellipse(xf, yf, 10, 10); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode.id=processing.mode.java.JavaMode | ||
mode=Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
float xh = 70; | ||
float yh = 70; | ||
float xo = 255; | ||
float yo = 55; | ||
|
||
void setup() { | ||
size(300, 300); | ||
} | ||
|
||
void draw() { | ||
background(255, 0, 0); | ||
line(xh, yh, xo, yo); | ||
float xf = xh + 0.2*(xo - xh); | ||
float yf = yh + 0.2*(yo - yh); | ||
ellipse(xf, yf, 10, 10); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode.id=processing.mode.java.JavaMode | ||
mode=Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
float xh = 70; | ||
float yh = 70; | ||
float xo = 255; | ||
float yo = 55; | ||
|
||
void setup() { | ||
size(300, 300); | ||
} | ||
|
||
void draw() { | ||
background(255, 0, 0); | ||
line(xh, yh, xo, yo); | ||
float a = map(mouseX, 0, width, 0, 1); | ||
float xf = xh + a*(xo - xh); | ||
float yf = yh + a*(yo - yh); | ||
ellipse(xf, yf, 10, 10); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode.id=processing.mode.java.JavaMode | ||
mode=Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
float xh = 70; | ||
float yh = 70; | ||
float xo = 255; | ||
float yo = 55; | ||
|
||
void setup() { | ||
size(300, 300); | ||
} | ||
|
||
void draw() { | ||
background(255, 0, 0); | ||
line(xh, yh, xo, yo); | ||
float a = map(mouseX, 0, width, 0, 1); | ||
float r = map(mouseY, 0, height, 1, 50); | ||
float xf = xh + a*(xo - xh); | ||
float yf = yh + a*(yo - yh); | ||
ellipse(xf, yf, r, r); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode.id=processing.mode.java.JavaMode | ||
mode=Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
class Drop { | ||
float x, y, r; | ||
float vy; | ||
Drop(float x, float y, float r) { | ||
this.x = x; | ||
this.y = y; | ||
this.r = r; | ||
vy = 0; | ||
} | ||
void update() { | ||
y += vy; | ||
vy += 0.2; | ||
} | ||
void draw() { | ||
ellipse(x, y, r, r); | ||
} | ||
} | ||
|
||
ArrayList<Drop> drops; | ||
|
||
float xh = 70; | ||
float yh = 70; | ||
float xo = 255; | ||
float yo = 55; | ||
|
||
void setup() { | ||
size(300, 300); | ||
drops = new ArrayList<Drop>(); | ||
} | ||
|
||
void draw() { | ||
background(255, 0, 0); | ||
// fill(255, 0, 0, 10); | ||
// rect(0, 0, width, height); | ||
// fill(255); | ||
line(xh, yh, xo, yo); | ||
float a = map(mouseX, 0, width, 0, 1); | ||
float r = map(mouseY, 0, height, 1, 50); | ||
float xf = xh + a*(xo - xh); | ||
float yf = yh + a*(yo - yh); | ||
ellipse(xf, yf, r, r); | ||
|
||
Drop drop = new Drop(xf, yf, r); | ||
drops.add(drop); | ||
int n = drops.size(); | ||
for (int i = n-1; 0 <= i; i--) { | ||
Drop d = drops.get(i); | ||
d.update(); | ||
d.draw(); | ||
if (height < d.y) { | ||
drops.remove(i); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode.id=processing.mode.java.JavaMode | ||
mode=Java |