Dynamic 3d space | Floating Sketches Tutorial

parallax_thumbI’ve had quite a few questions about how to make depth in flash. Earlier (like, 2 years ago) I put up an experiment file to give some interactive depth to some sketchbook sketches, see Floating Sketches. I’ve finally gotten around to translating that into as3. It’s still the same basic idea, Create layers of levels, and have each one respond to the mouse a little differently. The ‘closer’ depths will move faster while the farther away depths will be slower. A simple technique called Parallax.

  1. Seperate the scene into layers
  2. Place the layers in the correct depth
  3. Make closer layers react fast and farther layers slower

Example

[kml_flashembed fversion=”8.0.0″ movie=”https://circlecube.com/circlecube/wp-content/uploads/sites/10/2009/01/depth.swf” targetclass=”flashmovie” publishmethod=”dynamic” width=”550″ height=”550″]

Get Adobe Flash player

parallax_thumb
[/kml_flashembed]

Actionscript

[cc lang=”actionscript”]
//define number of layer.
var numLayers:uint = 15;
//number of items in a layer
var numBallsPerLayer:uint = 100;
var defaultBallSize:uint = 25;

var stageWidth3d:uint = 800;
var stageHeight3d:uint = 800;

var layers:Array = new Array();
//init
makeMatrix();
//3d created by layers and placing objects on each layer – the layer has it’s own distance, simulated by movement and alpha

function makeMatrix():void {
//walk through desired number of layers
for (var layerNum:uint=0; layerNumSource

depth.fla

4 thoughts on “Dynamic 3d space | Floating Sketches Tutorial

  1. Hi, very awesome work ! i build my website in as2 but i want to rebuild in as3

    i have a similar source for the float background controlled by the mouse in as2

    I am very interesting by your code but i am a beginner in as3 i am a graphic designer not a developer and it’s very hard for me :/

    it’s possible to have an help to modify your source for obtain the similar effect with white stars ?

    i am waiting for your answer
    Kind regards, Yann

  2. Great post. I’ve been trying to research this technique for manipulating layers in photographs(check out http://82.ufc.com/ ) and have found a few tutorials that use as2 but this is the first I’ve seen that is using as3. I’m quite new at all this and was hoping you c0uld show a simple as3 script to give this kind of functionality…much the same as your original floating sketches but in as3.

Comments are closed.