PDA

View Full Version : zoomin in/out


roler
12-03-2001, 06:15 PM
i have a movieClip that i want to zoom in and out, so that its a constant loop, nothin special i just can't seem to get it to work smoothly, i just want a constant loop on an onClipevent, no buttons actions needed...thanks for all everyones help....peace

Billy T
12-03-2001, 10:40 PM
animate the scale of the objects within the movieclip.

when the clip event occurs tell the movie to go to frame whatever and play

roler
12-04-2001, 03:17 AM
Originally posted by Billy T
animate the scale of the objects within the movieclip.

when the clip event occurs tell the movie to go to frame whatever and play is the done thru regular tweened animation? or can i do this thru the xscale/yscale?...peace

Billy T
12-04-2001, 06:05 AM
depends on what exactly you are trying to do...

tweened would probably be fine

roler
12-04-2001, 04:16 PM
i was tryin to avoid tween animation on a bitmapped picture, therefore keepin the file size down, i am after effects guy so learning this actScrp is mind numbing, but i`m tryin...once again thanks for your help...peace

evilregis
12-04-2001, 07:07 PM
here's how i would go about it... someone may have a more efficient way?!



onClipEvent( load ) {

// scale step value
step = 5;
// maximum MC scale
maxScale = 200;
// minimum MC scale
minScale = 50;
// set MC states
shrinking = false;
expanding = true;

}

onClipEvent( enterFrame ) {

// if the MC is expanding...
if( expanding ) {

// increase x and y scale by value of step
this._xscale += step;
this._yscale += step;

// if MC scale has reached maximum
if( this._xscale >= maxScale ) {

// stop expanding and start shrinking
expanding = false;
shrinking = true;

}

// if the MC is shrinking...
} else if( shrinking ) {

// decrease x and y scale by value of step
this._xscale -= step;
this._yscale -= step;

// if MC scale has reached minimum
if( this._xscale <= minScale ) {

// stop shrinking and start expanding
shrinking = false;
expanding = true;

}

}

}


.:er:.

tg
12-04-2001, 08:42 PM
movieclip.prototype.zoom = function(amount){
this._xscale+=amount;
this._yscale+=amount;
}

// put this on the clip you want to zoom

onClipEvent(load){
this.origx=_xscale;
this.origy=_yscale;
zoomed=false;
}

onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse,_root._ymouse,true){
zoom(5);
zoomed=true;
}else if(zoomed and _xscale>origx and _yscale>origy){
zoom(-5);
zoomed=false;
}
}



i put the zoom to work when you mouse over the mc, but it would be just as easy to fire from a button.

here's the file

evilregis
12-04-2001, 08:52 PM
here is the fla & swf for the code i posted earlier as well...

.:er:.

roler
12-05-2001, 12:41 AM
thanks evilregis, thats exactly what i wa lookin for, also thanks to tg, this for is soooooo helpful....peace yo....