Can someone help me on this, hints, tips anything. But I am really confused how to get this done.
Processing has functions that let you determine the time of day: second(), minute(), and hour().
You will use the minute and second functions to control a sketch with two items in it. Save the sketch with the name time. Use the minute() function to control the position of one item. Use the second() function to control the size of the other item.
The position and size changes must be evident. The fill color for the “seconds” indicator must not change. For example, you might choose a triangle as the indicator for the minute, and move it vertically down the sketch as time progresses. You might choose an ellipse for the second indicator, and make it longer as the seconds progress.
None of this requires the use of any conditionals (though if you do want to use conditionals for extra visual effect, feel free). Here are two further specifications which do require conditionals: Change the background color of the sketch depending upon which quarter-minute it is: 0-14, 15-29, 30-44, 45-59. Change the fill color of the minute indicator depending upon whether the minute is an even or odd number.
Although you are using the time functions, your sketch does not have to look like a clock. I don’t care if nobody can tell what time it is by looking at your sketch. It can be as representational or as abstract as you like, so be creative!
Here is an example; it is the clock as described above. Yours, of course, will look different. How do you find out if a number is odd or even? You use the % operator. This gives you the remainder after division. For example, 17 % 3 gives you 2, because 17 divided by 3 is 5 with a remainder of 2. Here’s the trick: if you divide a number by 2, you get a remainder of zero if the number is even, and a remainder of one if it’s odd.
So this code will print the appropriate message: int n = 27; if (n % 2 == 0) { println("n is even"); } else { println("n is odd"); }
This is what I have so far
void setup()
{ size(400, 400);
smooth(); }
void draw()
{ background(255, 102, 204);
triangle(200, 200, 180, 220, 220, 220);
rect(20, 20, 60, 60); }
I am wondering how to change the background every 15 seconds?
Processing has functions that let you determine the time of day: second(), minute(), and hour().
You will use the minute and second functions to control a sketch with two items in it. Save the sketch with the name time. Use the minute() function to control the position of one item. Use the second() function to control the size of the other item.
The position and size changes must be evident. The fill color for the “seconds” indicator must not change. For example, you might choose a triangle as the indicator for the minute, and move it vertically down the sketch as time progresses. You might choose an ellipse for the second indicator, and make it longer as the seconds progress.
None of this requires the use of any conditionals (though if you do want to use conditionals for extra visual effect, feel free). Here are two further specifications which do require conditionals: Change the background color of the sketch depending upon which quarter-minute it is: 0-14, 15-29, 30-44, 45-59. Change the fill color of the minute indicator depending upon whether the minute is an even or odd number.
Although you are using the time functions, your sketch does not have to look like a clock. I don’t care if nobody can tell what time it is by looking at your sketch. It can be as representational or as abstract as you like, so be creative!
Here is an example; it is the clock as described above. Yours, of course, will look different. How do you find out if a number is odd or even? You use the % operator. This gives you the remainder after division. For example, 17 % 3 gives you 2, because 17 divided by 3 is 5 with a remainder of 2. Here’s the trick: if you divide a number by 2, you get a remainder of zero if the number is even, and a remainder of one if it’s odd.
So this code will print the appropriate message: int n = 27; if (n % 2 == 0) { println("n is even"); } else { println("n is odd"); }
This is what I have so far
void setup()
{ size(400, 400);
smooth(); }
void draw()
{ background(255, 102, 204);
triangle(200, 200, 180, 220, 220, 220);
rect(20, 20, 60, 60); }
I am wondering how to change the background every 15 seconds?