Make It Read!

This took me a while and I must admit I’m rather swelling up with pride and sense of accomplishment. Look what I made:


It’s a project from Khan Academy. What’s so great about it? The books aren’t drawn one at a time with a block of code for each book. They’re all drawn using one function using a For loop to draw each book in the array. The X and Y coordinates are determined using variables based on the [i] position of the book in the array.


The drawing of the shelves could definitely be more elegant, but I’m quite happy with getting the books to move to the second shelf (that took me a while). I created a variable called column that resets back to zero if it has a value of four.


About jotascript

Aiming to please. Seeking to impress.
This entry was posted in JavaScript. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s