We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm new at processing, so it may be an easy question for you veterans:
I'm trying to code a "water circle effect", you know, a drop falls on a water surface and generates waves. In my case It must be super simple: 3 circles that expand after you click the canvas.
so far I managed to code so that the circles expands when i press the mouse and keep it pressed with this code:
void setup() {
size (500, 500);
smooth();
}
int radio = 10;
void draw() {
background (185, 229, 255);
fill(185, 229, 255);
if (mousePressed == true) {
noFill();
stroke(18, 163, 250);
ellipse(mouseX, mouseY, (radio/4), (radio/4));
noFill();
stroke(18, 163, 250);
ellipse(mouseX, mouseY, (radio/2), (radio/2));
noFill();
stroke(18, 163, 250);
ellipse(mouseX, mouseY, radio, radio);
radio++;}
if (mousePressed == false){
radio = 10;}
}
But i'd like the circles to keep expanding after i release the mouse button.
Could anyone help me out, please?
Answers
This is closer to what you want but it reverses direction on alternate mouse releases.
I've made own version. But it's more complex, b/c it uses 2 classes.
1 to define a Wave and the other to group 3 of it as a WaveTrio! <:-P
You can play it online at the link below:
http://studio.processingtogether.com/sp/pad/export/ro.9lTJ6qSlmCidk/latest
And here's the source. Don't fret to ask for any doubts about how it works: :-j
Thank you everybody for helping me out! :) I'm gonna study all the codes and apply them.
thank you again!
CoffeeScript Mode version: ~O)
When I load this page it gives me this alert 3 or 4 times then settle... Safari 7.0.6
Tell that to those responsible to this forum's scripts to fix the odious
@
bug! >:PAnd while at it, add support to
<pre lang="coffeescript">
SyntaxHighlighter too!It's an official Processing Mode, ya know? :-t
I've tried to place each code line inside ``, but I've lost indentation! :-q
And just like Python, indentation replaces curly brace blocks
{}
! #-oAnd finally, the p5js version! Just paste it in any http://p5js.org/reference/ editable example: o->