Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Actionscript 3.0 perlinNoise method

This is a discussion on Actionscript 3.0 perlinNoise method within the Tutorials forums, part of the Flash English category; As last night I could not fall asleep :P , I decided to take a look at the Method perlinNoise of ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  6 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 12-10-07, 17:34
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Actionscript 3.0 perlinNoise method

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
File Type: zip nuvole_notturne.zip (176.1 KB, 124 views)

__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !

Last edited by Flep; 05-06-08 at 15:35..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 19-12-07, 21:32
Junior Member
 
Join Date: Dec 2007
Posts: 2
Rep Power: 0
gphilly77 is on a distinguished road
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
File Type: jpg Untitled-4.jpg (27.1 KB, 31 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 20-12-07, 20:33
Junior Member
 
Join Date: Dec 2007
Posts: 2
Rep Power: 0
felixz is on a distinguished road
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 28-12-07, 17:39
Junior Member
 
Join Date: Dec 2007
Posts: 2
Rep Power: 0
gphilly77 is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 22-01-08, 16:32
Junior Member
 
Join Date: Jan 2008
Posts: 1
Rep Power: 0
springframework is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-12-08, 04:50
Junior Member
 
Join Date: Dec 2008
Posts: 1
Rep Power: 0
CWM73 is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-12-08, 10:05
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: Actionscript 3.0 perlinNoise method

Hi,
the followinf tutorial might help you:

How to display an SWF at 100%
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Dynamically adding a method to an Object with Actionscript 3.0 Flep Tutorials 0 14-10-08 06:26
New HitTest method of Actionscript 3.0 Flep Tutorials 3 05-03-08 23:06
getBounds method Flep Tutorials 0 20-12-07 06:38
BitmapData - draw method of Actionscript 3.0 Flep Tutorials 0 09-10-07 19:43
curveTo Method with Actionscript 3.0 Flep Tutorials 0 29-09-07 10:18


All times are GMT. The time now is 16:36.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap