I’ve got some code that reveals a mask in that swooshy/wavy style, which starts of nice and smooth at the top of the reveal but as it gets further down the page it speeds up and doesn’t look smooth.
Here is the code. I’ve also attached the example of what it is doing.
I’ve been looking at this code blankly for a couple days now and I’m still no further forward.
I’d really appreciate it if somebody could suggest where the answer to my problem lies.
//Global vars
mWidth = 600;
//Create movie clip and mask
counter = -1;
createEmptyMovieClip('holder',0);
createMovieClip();
animInt = setInterval(doAnim, 17);
holder._x =25;
holder._y =25;
function createMovieClip()
{
counter++;
holder.attachMovie('pic' add (counter % 2), 'pic' add counter, counter);
holder.createEmptyMovieClip('mask' add counter, counter + 10000);
holder['pic' add counter].setMask(holder['mask' add counter]);
}
function doAnim()
{
var currMC = holder['mask' add counter];
if(animIndex < 15)
{
var time = animIndex/15;
var dist = 0.5*Math.sin(Math.Pi*(time-0.5)) + 0.5;
with(currMC)
{
clear();
beginFill(0x000000);
lineTo(mWidth,0);
lineTo(mWidth,dist*225);
curveTo(250,dist*40,0,10*dist);
endFill();
}
}
else if (animIndex < 35)
{
var time = (animIndex-15)/20;
var dist = 0.5*Math.sin(Math.Pi*(time-0.5)) + 0.5;
with(currMC)
{
clear();
beginFill(0x000000);
lineTo(mWidth,0);
lineTo(mWidth,225);
curveTo(250-100*dist,40+150*dist,0,10+190*dist);
endFill();
}
}
else if (animIndex <= 50)
{
var time = (animIndex-35)/15;
var dist = 0.5*Math.sin(Math.Pi*(time-0.5)) + 0.5;
with(currMC)
{
clear();
beginFill(0x000000);
lineTo(mWidth,0);
lineTo(mWidth,375+75*dist);
curveTo(150,440+10*dist,0,450);
endFill();
}
}
animIndex++;
if(animIndex > 50)
{
animIndex = 0;
holder['pic' add (counter - 1)].removeMovieClip();
holder['mask' add (counter - 1)].removeMovieClip();
//createMovieClip();
clearInterval(animInt);
}
}
What I’m hoping to acheive is a nice smooth mask from top to bottom.
Thanks
Mark