Coding with Javascript to Draw a Snowman
The first javascript project I completed was a simple snowman made with just 3 circles sitting on top each other. To showcase it here involved multiple coding steps, as Blogger is not set up with predefined Javascript object functions to draw shapes.From Canvas Setup to Scalable Logic
I first had to create a drawing canvas with HTML for the Javascript to interact with. I also styled the drawing canvas with CSS to insure the drawing canvas stays completely visible when resized to fit a screen. Then, I defined shape object functions to easily access and draw the shapes needed to create the snowman.
Iterating for Detail
To enhance the scene, I iterated on the initial design to include a ground plane and limbs. I utilized variables for spatial positioning, ensuring these new elements remained aligned and easy to adjust during future refinements.
Strategic Animation Logic to Interaction
He was barely a snowman still, so I gave him more details. At first, I tinkered with the thought of animating the background with snow falling, but sandboxed it quickly as that is so typical. I made use of a few arrays and loops to allow for some animation and interaction. Now it's your turn! Please give him some more snow by tapping/clicking on the drawing!
Modular Performance Optimization
I refactored redundant code into a streamlined, modular architecture to meet modern performance standards, allowing me to showcase the progress of the project.
No comments:
Post a Comment