Project Description
Background
In this project, students use JavaScript graphics to create a fall scene with a tree changing the color of its leaves. The tree must have a circular treetop - full of leaves. At the start of their program, the tree’s leaves should be green. Then, using a setTimer()
function, the program updates the tree’s leaves with colors that gradually change with each call of the timer function.
Your Task
Create two functions in your program. Your main()
function sets up your scene and builds the elements - background color, tree trunk, leaves, etc. Your update()
function should be called with the setTimer()
function at the end of your main()
function. The update()
function changes the color of your tree leaves using the leaves’ current color condition or state. You might consider setting global leaves
and color
variables at the start of your program for use in your two functions.
You may want to refer to the standard and extended list of color names supported by most web browsers. You can use the color name, hex code, or RGB to update the leaves’ colors in your program.
Once you have a beautiful tree that changes the color of its leaves, add more trees, a pumpkin, or some text! Wish everyone a happy fall, Thanksgiving, or remind them it’s time to break out the rakes. Have fun creating your scene!