Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

flash page flip

Actionscript 3.0 video tutorials

+ Reply to Thread
Results 1 to 7 of 7

Thread: Actionscript 3.0 perlinNoise method

  1. #1
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Actionscript 3.0 perlinNoise method

    flash templates
    As last night I could not fall asleep :P , I decided to take a look at the Method perlinNoise of the BitmapData Class.
    I created a Class which simulates the effect of the clouds over a night scene.

    This is the result:







    The used Class is as followed:
    Code:
    package
    {
    	import flash.display.*;
    	import flash.geom.Point;
    	import flash.events.Event;
    	
    	public class Perling extends MovieClip
    	{
    		private var bitmap:BitmapData;
    		private var angle:Number=0;
    		private var _offset:Number=0;
    		
    		public function Perling()
    		{
    			this.init2();
    		}
    		
    		private function init2():void
    		{
    			this.bitmap=new BitmapData
    			(stage.stageWidth,stage.stageHeight,
    			 true,0xFFFFFFFF);
    			var image:Bitmap=new Bitmap(this.bitmap);
    			this.addChild(image);
    			this.addEventListener
    			(Event.ENTER_FRAME,onEnterFrame2);
    		}
    		
    		private function onEnterFrame2(event:Event):void
    		{
    			var point:Point=new Point(this._offset,0);
    			this.bitmap.perlinNoise(300,100,2,1000,false,
    			true,BitmapDataChannel.ALPHA,false,
    			[point,point]);
    			this._offset+=2;
    		}
    	}
    }
    Source files:
    Attached Files

  2. #2
    Junior Member Settled In gphilly77 is on a distinguished road
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Re: Actionscript 3.0 perlinNoise method

    Quote Originally Posted by Flep View Post
    As last night I could not fall asleep :P , I decided to take a look at the Method perlinNoise of the BitmapData Class.
    I created a Class which simulates the effect of the clouds over a night scene.


    Stay tuned !
    I really enjoyed this short tut since I was a bit tired of using the old style of cloud animation MoveClips.

    I am wondering what your input would be on the best way to convert this into code that generates basically a blue sky w/ white clouds, more of a daytime scene than nighttime.

    I started playing around w/ ColorTransform & ColorMatrixFilters, but really haven't been able to achieve the desired effect.

    See below:

    function initClouds():void {

    bt=new BitmapData(stage.width-11,120,true,0xFFFFFF);
    img = new Bitmap(bt);
    img.x = 6;
    img.y = 6;

    addChildAt(img,17);
    addEventListener(Event.ENTER_FRAME,onEnterFrame);
    }

    function onEnterFrame(event:Event):void{
    var matrix:Array = new Array();
    matrix = matrix.concat([0, 0, 0, 0, 0]); // red
    matrix = matrix.concat([0, 0, 0, 0, 0]); // green
    matrix = matrix.concat([0, 0, 0, .6, 0]); // blue
    matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha

    var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
    var filters:Array = new Array();
    filters.push(filter);

    var point:Point=new Point(this._offset,50);
    var channels:uint = BitmapDataChannel.ALPHA;

    bt.perlinNoise(300,100,2,1000,false,true,channels, false,[point,point]);
    img.filters = filters;
    }

    I really want to lighten up the blue in the matrix incorporate some kinda of gradient w/ the bitmap so the "clouds" that are generated are rather faded from the bottom up. As can be seen in the screen shot below, I do'nt want the clouds on top of the mountains.


    Thanks alot

    GP
    Attached Images

  3. #3
    Junior Member Settled In felixz is on a distinguished road
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Re: Actionscript 3.0 perlinNoise method

    This looks interesting and also lighten up image
    Code:
    perlinNoise(250,100,8,Math.random() * 1000,false,true,BitmapDataChannel.ALPHA|BitmapDataChannel.BLUE|BitmapDataChannel.RED|BitmapDataChannel.GREEN,true)

  4. #4
    Junior Member Settled In gphilly77 is on a distinguished road
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Re: Actionscript 3.0 perlinNoise method

    That worked great...and in order to soften the clouds I placed a sprite with a gradient on top...thx alot

  5. #5
    Junior Member Settled In springframework is on a distinguished road
    Join Date
    Jan 2008
    Posts
    1
    Rep Power
    0

    Re: Actionscript 3.0 perlinNoise method

    wow, thats fabulous. so simple. thanks for the tutorial on how to use perlin noise on bitmaps.



    Jesse Couch Actionscript 3.0

  6. #6
    Junior Member Settled In CWM73 is on a distinguished road
    Join Date
    Dec 2008
    Posts
    1
    Rep Power
    0

    Question Re: Actionscript 3.0 perlinNoise method

    great script. thanks so much.

    my question is: how can i make this fullscreen?

    i want to make a pc/mac projector that fills up the whole screen. any ideas how i can achieve this?

    thanks in advanc- c

  7. #7
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Actionscript 3.0 perlinNoise method

    Hi,
    the followinf tutorial might help you:

    How to display an SWF at 100%

+ Reply to Thread

Similar Threads

  1. curveTo Method with Actionscript 3.0
    By Flep in forum Tutorials
    Replies: 1
    Last Post: 23-01-10, 16:18
  2. New HitTest method of Actionscript 3.0
    By Flep in forum Tutorials
    Replies: 5
    Last Post: 25-08-09, 15:13
  3. fileLoaded Method
    By olicorse in forum Flash English
    Replies: 3
    Last Post: 08-04-09, 02:51
  4. Replies: 0
    Last Post: 14-10-08, 05:26
  5. Replies: 0
    Last Post: 09-10-07, 18:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts