mirror of
https://github.com/dyne/FreeJ.git
synced 2026-02-05 12:39:15 +01:00
processing-js 0.4 has been merged in some relevant parts basic and topic scripts added for test color handling fixed, more scripts show up now
28 lines
665 B
Plaintext
28 lines
665 B
Plaintext
void setup()
|
|
{
|
|
size(200, 200);
|
|
background(102);
|
|
smooth();
|
|
}
|
|
|
|
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);
|
|
}
|