UltraMega Blog
1Sep/101

Record HTML Canvas Animations to Video

Sometimes it might be useful to be able to record your canvas animation to a video format. Maybe you want to use your JavaScript skills to create fancy effects for a video. You could use some kind of screen capturing program and crop the video, but I'll show you how to do it with code!

Note: You'll need an HTTP server with PHP running on your local machine to do this. Don't try this with your website over the Internet, unless you don't mind waiting for tons of images to upload... Also, I recommend using Chrome for best results.

Let's start with our simple animation. You can see it in action here.

3Apr/090

How To Center a Page With CSS

When designing the layout of a web page, it is common to want to center the entire page. Luckily, this is very easy to do without breaking standards. All you have to do is wrap the entire page with a div with the left and right margins set to auto (margin: 0px auto;).

Here is an example:

<html>
<body>
<div class="wrapper">Contents of page...</div>
</body>
</html>
.wrapper {
   margin: 0px auto;
   width: 600px;
}

Here, margin specifies the top/bottom and the left/right respectively.

That's all there is to it!