Hello to everyone. Can someone explain to me , How can I run a :
for( int i=100; i>0; i=i-10 ) {
ellipse(100,100,i,i);
}
Using a function?!
Thank you , i DON’t want a code but need to understand for classroom activity.
Hello to everyone. Can someone explain to me , How can I run a :
for( int i=100; i>0; i=i-10 ) {
ellipse(100,100,i,i);
}
Using a function?!
Thank you , i DON’t want a code but need to understand for classroom activity.
for using a function you need a full sketch with setup and draw and your new function.
For setup()
and draw()
see https://www.processing.org/tutorials/overview/
A function can be inserted at different levels of your sketch: You could either
myEllipse(float i)
) that gets i as a parameter ORellipseArt()
) without parameters.More about functions: see https://github.com/Kango/Processing-snippets/wiki/programming-and-functions
To be honest I’m newbie ( first three months of experience)
void setup() {
size(500,300);
background(255);
for(int i=100; i>0; i=i-10) {
ellipse(100,100,i,i);
}
}
void draw() {
}
Should I create a function calling ABC… with int/void? I really want to improve My self. Can you pls do some Example?
void setup() {
size(500, 300);
background(0);
}
void draw() {
background(0);
for (int i=100; i>0; i=i-10) {
myEllipse(i);
}
}
void myEllipse(float i) {
ellipse(100, 100, i, i);
}
and welcome to the forum!
Great to have you here!