// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 4-3: Varying variables
// Declare and initialize two integer variables at the top of the code.
int circleX = 0;
int circleY = 100;
void setup() {
size(200,200);
smooth();
}
void draw() {
background(255);
stroke(0);
fill(175);
// Use the variables to specify the location of an ellipse.
ellipse(circleX,circleY,50,50);
// An assignment operation that increments the value of circleX by 1.
circleX = circleX + 1;
}
so what is the solution to varying the speed at which the circle grows? I wound up using the abs() call as it was in the previous chapter.
Comment by Gabe — October 17, 2009 @ 11:31 pm
In this case, you just want to define a variable for the size of the circle, instead of hardcoding the number 50 in, i.e.
Then you use those variables when drawing the circle.
And then adjust the values however you like!
Comment by admin — October 18, 2009 @ 8:49 am
Thanks. I’m sure I’ll have more questions in the hover chapters…:)
Comment by Gabe — October 18, 2009 @ 10:42 am