Close Show/hide page

Actionscript Halftone Effect

April 6th, 2007


Some of the most satisfying graphics effects are simple in concept and execution. Like programmatically creating a half tone-style image from a bitmap, as it turns out (as seen in the blog masthead). I got this right essentially on my first try.

Here’s the class in Actionscript 3. It’s esssentially one public method which takes in a bitmap and writes to a sprite. With a few optional parameters. See the source code comment block for the details. I believe it’s pretty well optimized, but would love to see any improvements made to it for speed.

To do: Add the ability to use overlapping colors. Apparently, the dot patterns for additional colors are supposed to be set at different angles from each other — which is less straight-forward, programmatically speaking, than simply setting the ’screen angle’ to 45-degrees, as I’ve done here. Please post any good ideas or improvements to the code below.

Version: 0.9

Licensed under a Creative Commons Attribution 3.0 License.

Flash Webcam DVR

April 6th, 2007

Thumbnail - Click me

I recently spent a couple weekends geeking out to make this. It’s pure Actionscript 3, which meant excessive amounts of code to draw the UI.

You’ll need a webcam to test this.

Big caveat: This eats up a _ton_ of memory, as the video is simply made up of hundreds of frames stored in an array of BitmapData. Bigger caveat: The save and load feature is only practical for very short video clips, and will otherwise bring down the browser (!). It stores megs of data to a local SharedObject, which surely constitutes a criminal abuse of what LSO’s are designed to do. Hah. Rational: When doing personal stuff, I’m only half-interested in questions of usability and stability (Did I just say that?! LOL.)

To-do, hopefully: Port to Apollo. (But first learn how to use Apollo, haha). Offload video data from memory to disk using the Apollo file I/O API (Thanks, Béla, for the idea).

To-do, ideally: Find a solution to compress video to memory/disk on the fly.

Version: 0.8