Close Show/hide page

Archive for the ‘Flash experiments’ Category

Robot Arm, Slideshow Viewer

Thursday, June 19th, 2008
Thumbnail - Click me

This is a slideshow viewer, utilizing the robot arm from this previous post done with Papervision 3D. I created it on the occasion of a presentation I’m preparing for the Flash user group, San Flashcisco. In typical fashion, I’ve spent more time creating the slideshow program than preparing the presentation itself, or the slides for it. :P The slides themselves (dealing with Papervision3D) aren’t of too much value outside of the context of the presentation, but you can choose your own if you like (see below).

The program uses hotkeys only –


  [SPACE/BACKSPACE]  Next/previous slide
  [BRACKET KEYS]     Next/previous slide without transition
  [COMMA]            Zoom in and out of slide, for the fun of it

   Also:             [1/Q, 2/W, 3/E, 4/R, 5/T, 6/Y, and 7/U] - Rotate joints
                     [Z,X,C,V] - Moves robot arm to various keyframes/poses

How to use this with your own images, from the Desktop…

(more…)

Strange 3D objects, Perlin noise

Sunday, May 18th, 2008
Thumbnail - Click me

Recently I’ve been thinking on ways of programmatically creating curvy and strange, organic-looking shapes in 3D. And reflecting on the fact that I can think of no particular ‘practical’ application for such an endeavor. And concluding that that’s part of what makes it interesting…

Here’s the high-level recipe:

Start with a cylinder or sphere-shaped mesh, where the vertices are evenly spaced . The vertices of the mesh can be thought of as a matrix or grid, where the left and right edges are curved 360 degrees until they meet.

Take an interesting bitmap with varying light and dark areas, whose height and width match the number of rows and columns in the mesh.

Use brightness (or some other color-derived property) from the pixels of the bitmap as a multiplier value to dictate the distance of the corresponding vertices from the z-axis (center) of the shape.

That’s basically it. In Flash, the built-in BitmapData.perlinNoise method is perfect for generating interesting gradients. The kicker is that the last parameter of the method allows you to change the x & y offset for each ‘octave’ (think semi-transparent layer), allowing for gradual, random-looking changes over time.

So on each update, change the offset of each octave of the perlin noise image and recalculate the vertices accordingly. The behavior and properties of Perlin noise does the rest.

Main class.as | Project.zip (Flex Builder 3)

Licensed under a Creative Commons Attribution 3.0 License.

Webcam Digital Video Recorder for AIR, updated

Wednesday, April 9th, 2008

Webcam DVR has been updated for compatibility with the release version of Adobe AIR. I didn’t introduce any serious changes with this version. I don’t have the time to self-QA this in the way it deserves, so if you run across any bugs - big or small - please let me know!

Download (Adobe AIR file, 291K)

Requires the Adobe AIR runtime.

See the original post for more info and usage notes.

Apologies for the cobwebs on this site. I’ve been pretty busy with .. work.

Testing Kinematics with Papervision3D, Collada

Wednesday, January 30th, 2008
Thumbnail - Click me

A forward kinematics experiment using Papervision3D v2.0 alpha and a Collada 3D model of a robotic arm.

Hope you enjoy it.

I don’t want to release any source from this yet, as I want to do some more work on it, relating to the following items…

(more…)

A Papervision 2.0 alpha example

Monday, January 7th, 2008
Thumbnail - Click me

I drew up this example a few weeks ago to learn about the new features in Papervision 2.0 alpha. If you’re thinking of looking into the new version, then hopefully you’ll find the supplied source code below of some use. I used the code from this screencast on unitzeroone.com as a starting point.

The source code has example usage of the following things…

(more…)

Collision detection between particles and polygons

Saturday, January 5th, 2008
Thumbnail - Click me

A basic example of collision detection in 3D, where moving particles bounce off a static terrain.

[By the way, my apologies for the cobwebs that have accumulated on this site; I’ve been busy over the past few months dealing with moving back to the Bay Area from Detroit :) ]

A couple things on it which could be of use …

(more…)

Particle Field

Monday, September 24th, 2007
Thumbnail - Click me

A matrix of vectors acting upon a field of particles. Reminiscent of falling water or snow, slightly. Click and drag to ‘draw’ vectors on the field to influence the movement of particles.

For me, the idea comes from Charles Forman’s blog post in Setpixel from 2004, “Snow is fun.” Which is incredibly great. And done in Processing.

Source code:

- Actionscript 3 class

- Full project (Flash 9/AS3)

Licensed under a Creative Commons Attribution 3.0 License.

SimpleFlvWriter.as - AS3 Class to Create FLV’s

Saturday, 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.

Seam Carving in AS3, with source

Sunday, September 2nd, 2007
Thumbnail - Click me

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:

Static utility class | App class | Project ZIP file

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.

Online portfolio

Monday, August 27th, 2007
Thumbnail - Click me
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.