Actionscript 3 Clouds

May
8

I made my own rendition to AS3:Cookbook example of Perlin Noise, an effect created for Tron believe it or not.

[as]

package {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.geom.Point;
import flash.display.BitmapDataChannel;

public class Clouds extends Sprite
{
private var _bitmap:BitmapData;
private var _xoffset:int = 0;
private var _w:Number
private var _h:Number

public function Clouds(w:Number, h:Number)
{
_w = w;
_h = h;
_bitmap = new BitmapData(_w, _h, true, 0xffFFFFFF);
var image:Bitmap = new Bitmap(_bitmap);
image.x = image.y = 0;
addChild(image);
addEventListener(Event.ENTER_FRAME, onEnterFrame);

}

public function onEnterFrame(event:Event):void
{
_xoffset++;
var point:Point = new Point(_xoffset, 0);

_bitmap.perlinNoise(200, 100, 2, 1000, true, true, 8, true, [point, point]);
}
}
}

[/as]

 

5 Responses to “Actionscript 3 Clouds”

  1. Matt says:

    You is a rock star!

  2. Aaron Da Master says:

    Wow! Thanks for this!! So few lines of code to create an amazing effect!! This is so useful!

  3. This Script is indeed usefull. Combined with multilayering and blendMode makes it a very nice Cloud-Effect. Thanks!

  4. eros says:

    can you explain me how tu use this as? would be so kind? thanx..a mini tutorial..

Leave a Reply