September 8th, 2007
An Actionscript 3 class for use with Adobe AIR to create uncompressed Macromedia Flash Video (FLV) files to the local filesystem. It will add proper onMetaData info as well. It’s very simple to use.
Example usage:
var myWriter:SimpleFlvWriter = SimpleFlvWriter.getInstance();
myWriter.createFile(myFile, 320,240, 30, 120);
myWriter.saveFrame( myBitmapData1 );
myWriter.saveFrame( myBitmapData2 );
myWriter.saveFrame( myBitmapData3 ); // ... etc.
myWriter.closeFile();
See the comment blocks in the source for more info. It doesn’t support audio.
This comes out of the app I made a little while ago, Webcam DVR. I’m posting the class file now because the app is fresh in my mind, as I just updated it to make it compatible with the current AIR runtime to enter it into the Adobe AIR Developer Derby.
Download Webcam DVR for AIR, updated for the beta AIR runtime (See the previous Webcam DVR post for usage notes).
Licensed under a Creative Commons Attribution 3.0 License.
Posted in Flash experiments | 23 Comments »
September 2nd, 2007
Seam carving — the recently unveiled technique by Shai Avidan and Ariel Shamir to intelligently resize images (YouTube; white paper) — really captured my imagination when I came across it last night, as it has for many others.
Like Hector Yee (whose writeup was very useful), I decided — geek that I am — to try my hand at an implementation of it just for the hell of it. But in Actionscript 3.
The attached demo only resizes images vertically, not horizontally. I wish I could have, but didn’t bother including a dynamic image loader. It’s also, well, very pokey, but the code is readable and the output seems accurate. If you can stand the wait, press [M] a few times to load up the seam calculation queue.
But the most valuable thing about this demo is its publicly available source code under a Creative Commons license:
So if you’re so inclined, please improve, extend, optimize, and/or port this code. I’m not planning on doing any further work on it. Just let me know if you find the code useful, and share your work.
If you’re interested in a more fully-realized online demo of seam carving, someone’s done it up in Java here.
Update: Additionally, as it turns out, Patrick Swieskowski has already put up an online seam carving Flash demo here.
Version: 0.8
Licensed under a Creative Commons Attribution 3.0 License.
Posted in Flash experiments | 13 Comments »
August 27th, 2007
After two failed attempts in the last year or so, I’ve finally done up a Flash-based
online portfolio page that I’m willing to call finished. For better or worse, I decided to use the guts of the
3D sine wave demo as a visual centerpiece for it.
One point of interest is that while the thumbnail images are preloading and the progress bar is up, it’s actually measuring the framerate of the 3D animation in the background, and then based on the results, adjusts the detail level of the plane accordingly.
Posted in Flash experiments | 2 Comments »
August 13th, 2007
A wavey liquid surface being hit by rocks.
For best performance, you’ll want to use the version 9.0.60 Flash Player with a multi-core CPU. Press D to lower the level of detail if it’s killing your browser.
Other controls:
T cycles through different textures
B cycles through texture blend modes
W shows the 3D wireframe
+/- moves the camera in and out
Spacebar pauses the action, allowing you to rotate around the scene
Conceptually, here’s whats going on… (Snooze alert!)
Read the rest of this entry »
Posted in Flash experiments | 25 Comments »
June 20th, 2007
A motion study using a simple “particle system” to create organic, flowing movement suggestive of tadpoles or sper|m. Particles gravitate towards each other based on mass and proximity.
Possible to-do’s could include adding… optimization (!); three dimensions; obstacles; collision detection; repulsion in addition to attraction; ‘environmental’ effects like wind or current; rules to govern particle life cycle…
Posted in Flash experiments | 5 Comments »
May 16th, 2007
I’m pleased to announce the first public release of Webcam Digital Video Recorder for Apollo, which lets you record webcam video to the local file system while simultaneously playing back video from the same file (timeshifting). Unlike its
browser-bound predecessor, this Apollo port does not rely on system memory to store video, but instead uses the Apollo File API to asynchronously save and load video on the fly, and can also convert its video to Macromedia Flash Video (
FLV)
format.
Download (requires Apollo AIR runtime, webcam)
* Updated for compatibility with the Adobe AIR runtime 1.0, 4/9/2008 *
Read the rest of this entry »
Posted in Flash experiments | 24 Comments »
April 27th, 2007
As I’ve been updating Flash Webcam DVR to Apollo, I came up with a kind-of amusing idea of overlaying alpha images from a webcam across the desktop area. The key was plugging in the right magic numbers into the ColorMatrixFilter class (See source code below). While running the program, click on the image to toggle filters.
Download (requires Apollo runtime, webcam)
- Source code for main class file
- All project files
Version: 0.9
Licensed under a Creative Commons Attribution 3.0 License.
Posted in Flash experiments | No Comments »
April 22nd, 2007
A few improvements have been made enhancing visual quality as well as overall framerate under load, plus a few presentation and interface-related tweaks.
The main class file for the effect has been updated as well.
Thanks to Carlos Ulloa and Alexander Zadorozhny for their thoughts on the Papervision3D mailing list.
Posted in Flash experiments | 9 Comments »
April 19th, 2007
The venerable Flash effect of turning a page in a book done in 3D. I originally designed and programmed this effect in Actionscript 2 using a home-grown 3D class library at about the time Papervision was entering public beta. This implementation using Papervision3D and AS3 runs a few times faster.
Press ENTER to create new instances of the book. Press it several more times and watch your browser chug :).
Here’s the main class for the page turn effect. I used the code for the PV3D Plane class as a starting point (but, in hindsight, probably should have subclass’ed from it instead). To create the appearance of a rotation of the 3D object, the individual vertices are rotated around the Y axis by increasing amounts depending on their (original) position along the X axis.
Version: 0.9B - Last updated on 4/22/2007
Licensed under a Creative Commons Attribution 3.0 License.
Posted in Flash experiments | 13 Comments »
April 7th, 2007
An image fade/dissolve where the individual pixels move off the bitmap and disappear. Written a couple months ago to learn how to get around in AS3. Not to be confused with the built-in BitmapData.pixelDissolve method.
In the supplied AS3 class, the direction of the movement of pixels is ‘hard coded’ to go from right to left. (Here’s the full project, as well.) To move the pixels in the opposite direction or up and down, the bitmap is rotated 90, 180, or 270 degrees and the wrapper sprite is rotated equally in the opposite direction - which is possible to interpret as a kludge.
To-do: Change the method used to select pixels that are to be animated. The way it’s done now is inefficient. If you look at the code, you’ll see what I mean. Again, if anyone wants to post any changes to the class that improves performance, please do.
Some other possible to-do’s: Dissolve images in an arbitrary direction; allow pixels to trail beyond the current boundaries of the bitmap; allow for the changing of parameter variables’ values while the effect is in progress; support for transparency.
Eating away individual pixels of a bitmap similar to what’s done here, it seems to me, could be the basis for some fun retro gameplay mechanics for a Flash-based game, à la Lemmings or Worms.
Version: 0.9
Licensed under a Creative Commons Attribution 3.0 License.
Posted in Flash experiments | 8 Comments »