-
bitmapData.noise: any way to control speed of change?
Hi,
Moved to ActionScript 3 section
I have beginner skills using AS3 and have been trying to improve a basic movie that generates a visual noise pattern. I need it for an eLearning lesson.
A while back, I got some help pulling this script together. It uses bitmapData.noise to generate a visual noise pattern. It can be viewed here:
http://www.eLearningprojects.com/WN1.html
I checked with a colleague who is expert on the use of these visual patterns, and he suggested that the change speed is too fast: that the dots (pixels) need to change at just under 400 dots per second for an 800 x 600 stage.
I tried changing the "seed" parameter, but while this slowed down the pixel-dot change, it did not run smoothly.
I'm not sure what else can be scripted to accomplish slowing down the change rate and would appreciate any help.
I will attach the AS3, which is currently in the first keyframe.
Actionscript Code:
var array:Array=new Array(); for (var i:uint = 0; i < 255; i++) { array[i] = 0xffffff * (i % 2); } var _bitmapData:BitmapData; var bDHolder:Sprite = new Sprite(); _bitmapData = new BitmapData(stage.stageWidth/4, stage.stageHeight/4);
bDHolder.addChild(new Bitmap(_bitmapData)); bDHolder.scaleX = bDHolder.scaleY = 4;
addChild(bDHolder);
addEventListener(Event.ENTER_FRAME, onSpriteEnterFrame);
function makeNoise():void { _bitmapData.noise(getTimer(), 100, 255, 7, true); _bitmapData.paletteMap(_bitmapData, _bitmapData.rect, new Point(0,0), array, array,array); }
function onSpriteEnterFrame(event:Event):void { makeNoise(); }
var itsNoisy:Boolean = true;
stage.addEventListener(MouseEvent.MOUSE_DOWN, manageNoise);
function manageNoise(evt:MouseEvent):void { if(itsNoisy){ removeEventListener(Event.ENTER_FRAME, onSpriteEnterFrame) } else { addEventListener(Event.ENTER_FRAME, onSpriteEnterFrame) } itsNoisy = !itsNoisy; }
Thanks in advance for your help.
Kind Regards,
saratogacoach
Last edited by saratogacoach; 10-25-2010 at 04:57 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|