Introduction to our course

Welcome to my blog, Digital Communications, which will document my progress and activities throughout the BTEC Interactive Media course.

Saturday, 12 February 2011

Experimenting with actionscript - Website Project

I have decided to pick 'The Adjustment Bureau' as a website project, and as part of getting some ideas together I have been tinkering with actionscript to test out a few of those ideas.
One of them being a camera/surveillance type effect, with crackling/rolling scan lines.
So what I have done is have two pictures, one being the actual image i want the effect on, and the other is a image of scan-lines or you could have a load of tv snow, fuzz, whatever. Scan-lines seem to work good for this though.
Then its just a matter of overlaying the scan image ontop of the original and mucking about with the alpha settings and in my case, i am also changing the y scale and height placement of the image. I do this in a loop and every change is randomized to some extent so that it looks as real as possible without looking like a simple repeated pattern.
The .swf is here if you want to have a look..
http://www.internalimage.co.uk/screen-fuzz.swf

Here is the code: There are two alternates in there, the first being whether or not to do the fuzzy effect, and the other decides whether to do a 'sliding down screen' effect or just a random anywhere one..


var vAlpha = 100;
var vScale = 0;
var bScroll = 0;
var bRotate = 0;
var startTime:Number;
var waitTime:Number;
var doFuzz = false;


startTime = getTimer();
waitTime =  Math.ceil(Math.random()*1000);


onEnterFrame = function() {


//toggle between doing fuzz and not to give more randomness
if( (getTimer() - startTime) > waitTime)
{
if(doFuzz == false) doFuzz = true; //switch flags
else{
doFuzz = false;
picfuzz._alpha = 0; //hide the fuzz!
cctvpic._alpha = 100; //full show on pic
}
startTime = getTimer(); //reset timer
waitTime =  Math.ceil(Math.random()*10000) + 1; //set a new random time delay
if(doFuzz == true) waitTime = waitTime / 2;
}

if(doFuzz == true)
{
// picfuzz._y += 1;
bScroll = Math.ceil(Math.random()*25);
if(bScroll <= 10)
{

picfuzz._y = cctvpic._y + Math.ceil(Math.random()* cctvpic._height-40);
picfuzz._yscale = Math.ceil(Math.random()*60);

picfuzz._alpha = Math.ceil(Math.random()*35);
// cctvpic._alpha += 1; //Math.ceil(Math.random()*25);
}
else
{
picfuzz._y += 1; //cctvpic._y + Math.ceil(Math.random()* cctvpic._height-50);
picfuzz._yscale += 1;// = Math.ceil(Math.random()*40);

picfuzz._alpha += 1; //Math.ceil(Math.random()*25);

cctvpic._alpha = Math.ceil(Math.random()*25) + 75;
}

}
}

No comments:

Post a Comment