Webomator: Bradley W. Schenck's blog
Bradley W. Schenck's books Webomator Blog Topics Archives Retro Sci Fi
Search retro robot art
Subscribe RSS retro future Bradley W. Schenck at Facebook Bradley W. Schenck at Goodreads Bradley W. Schenck on Twitter Bradley W. Schenck at DeviantArt Bradley W. Schenck Also by Bradley W. Schenck I play games.
Fun and games with Javascript animations

Filed under Web Development, Works in Progress

Some frames from Javascript animations

I’ve just finished up about twelve days of work on a set of Javascript animations for a web site. The site itself won’t be reachable until some time next year, so I can’t show you that. But here you can see a few individual frames and elements from the set.

Because they’re meant for the web, there are very few frames. I have to allow enough time after the page loads, and before the animation plays, for all the frames to get loaded. For that reason there’s a very simple animation that plays first, and there are only two animations on each page.

There are usually two things going on in each animation. There’s a primary motion that carries the element around the page, and a secondary action that’s sometimes a limited animation within the element, and sometimes a special effect.

Actaeon rocket sprite

This meant I needed to use Javascript’s setInterval() function twice. The first time sets the delay before the animation starts, while the second one sets the frame rate for everything that happens, once it does. I never had to set a third interval, though I did schedule some updates to occur on every second or third frame.

The site’s page layout responds to the browser window’s width and it changes any time the window’s resized. That did lead to some conceptual weirdness. I can’t predict how large the browser window is, or whether its size may change between one frame and the next. In some cases I had to deal with unexpected outcomes when I resized the browser.

Everything seems to work now. There’s just one case – an element that travels along an arc – in which phones may have trouble keeping up with the frame rate. I can’t test that because I don’t use a mobile phone. But the math in that one instance is fairly intense; I don’t think any of the other animations will present a problem.

And I may even do one or two more before you get a chance to see them. But, honestly, this was just a twelve-day obsession. I really ought to be working on something else. It’s just that it’s nearly impossible for me to leave something alone when it almost, almost works.

 
 

Leave a Reply

Your email address will not be published. Required fields are marked *

webomator
The Webomator Blog is powered by WordPress.
Down in the Basement. Where it Strains Against its Chains and Turns a Gigantic Wheel of Pain, for all Eternity. Muahahahahaha.