Below are some of the many lab/experiment posts I posted on my old blog, I cleaned them up a bit and have found source code for them all. Hope you like it :-)3D Interactive Cube
For really simple 3D in Flash, it's sometimes nice to use the native Flash Player 3D instead of a large engine (like Papervision or Away). This is an example of the 3D cube I developed for Kenneth Elgaard's website
, which received a FWA. It's very lightweight and it's easy to adjust shading etc.
Try the demo, and try resizing your browser, to see the cube scaling to fit.Download source herePerfect gradients in Flash
As most of you Flash developers probably have experienced, Flash (and Photoshop for that matter) doesn't create perfectly smoothed gradients!
The common trick is to apply a little noise to the image. But for runtime drawn graphics, this is obviously not so easy. So I created this simples class, to create gradient rectangles with less banding and without loading an image.
Obviously this is not always the better solution - sometimes you don't want noise in the image and sometimes there is no banding problems with your colors - but in some cases (especially large background gradients) this could be very useful.
The class only supports rectangle gradients with 2 colors - either in linear or radial gradient style, but feel free to extend it as you please.
Take a look at the demo (click to switch between different examples).
Every example has 3 PerfectGradients - 1 with only noise, 1 with both noise and blur, and 1 without any (clean gradient).
The banding issues are hard to see on small screen resolutions.Download source herePiecharts and circles
I have seen a lot of Flash developers struggling with the issue of drawing and animating piecharts. I recently developed this simple class to take care of this, so I hope it gives someone a helping hand.
It's really simple, just use a radius, start-angle and an end-angle. By tweening the end-angle value, you get an animated piechart - simple but nice!Download source hereDistortion Engine version 1
Some time ago I developed some distortion classes in order to achieve an rgb split effect and some random perlin noise. I found out that a small "engine" for those purposes would sometimes be very useful (at least to me), so now I finally had time to wrap it up.
To call it an engine is maybe a bit overstated, actually it's just a quick way to set up different types of distortion and change the amount of distortion applied.
In the demos I have used it with TweenMax
, and I have tweened the distortion value from 0 to 4 and back to 0 (you can apply any amount you want, 4 is just what I used).
The engine has 5 different distortion types: Cubic noise, Distort, Noise, Perlin noise and RGB distort (split effect).Download source hereSmall bending experiment
I have been looking for an easy way to use as3dmod
to bend materials without using a large 3d engine. But as3dmod works only with the more advanced engines like Away3D and Papervision (and it works very well with them).
However I sometimes need (and wish for) a lighter version, which is easy to use in small projects, banners etc. and this is the purpose of my own "bend" modifier. It's really simple and can't do half of what as3dmod is capable of (it's not build with triangles but simply rows of squares!), so there's no twisting etc. but only a simple bend is possible.
The good thing from my point of view, and the reason I created this, is that it uses the native 3d in Flash Player. My demo is below 12 kb in size (including the TweenLite engine!).Download source hereWebcam stream dynamically RGB splitted
I was inspired by a cool RGB splitting effect on an image I saw recently, but I figured it would look cool to have it be even more interactive. This led me to develop a small experiment.
It's a simple webcam stream which rgb splits the bitmapdata in 3d space according to the mouse position – just move around your mouse cursor and see.
Nothing crazy actionscript wise – but it looks cool, right?Download source hereCurveTo experiment
This is my simple elastic line example. It's pretty basic, the trick is to use the curveTo function and to add the bounce/elastic feel which is all about math (of course).Download source here_