Hello dudes,
I am a newbie in using the Processing Language. I have developed a small application which displays randomly circles on the phone screen. Their radius is also one of the first 20 fibonacci numbers in magnitude. I have added a mousePressed() event in order to save my creations. However, my app closes instantly when I touch the screen with my finger. Can you help me in order to solve this problem?
My code:
void setup() {
size(displayWidth,displayHeight);
smooth();
background(random(255),random(255),random(255));
}
void draw() {
noFill();
stroke(255);
strokeWeight(4);
for(int i=0; i<20; i++) {
ellipse(random(width),random(height),fibonacci(i)/5,fibonacci(i)/5);
delay(10);
}
}
int fibonacci(int n) {
if (n==0 || n==1) {
return 1;
}
return fibonacci(n-1)+fibonacci(n-2);
}
void mousePressed() {
saveFrame("/sdcard/img-####.png");
}
void delay(int ms)
{
try
{
Thread.sleep(ms);
}
catch(Exception e){}
}
The Android API I am using is the one recommended by the Processing Wiki.
Thanks in advance!