Sie sind auf Seite 1von 1

Challenge: Exploding Sun

Step 1 of 2:
Prepare to animate!
Right now, this program just draws a sun that never moves (boring!). To prepare to animate it,
make a draw() function and move all the shape drawing commands inside of it.

Be careful about how you write the (parentheses) and {curly braces} after ​draw = function​.
They have to look like the hint code, you can't miss any or the computer will get confused.
HINT: The var sunSize is already typed for you as is most of the other code. All you have to do
is type the: draw = function and than copy and paste the code inside the function.

Step 2 of 2:
Explode the sun!
Now, to make the sun get bigger, add 1 to the ​sunSize​ variable inside the ​draw​ function.
Tip: do it using the same technique we used on the ​x​ variable from the last talk-through, except
this time you should use it on ​sunSize ​instead of ​x​.
Remember you can press 'Restart' to restart the animation.
HINT: The only code your adding here is the code on line 9. This says, take sunSize and
add 1 to the number. Since its in the draw function it keeps adding 1 to the number over and
over again and never stops. The draw function is a loop and beginning animation. Very
similar to the video you watched.

Das könnte Ihnen auch gefallen