Perspective with a twist

Hey I have been working on the perspective tutorial and I’m trying to create an effect that zooms from out to in then stops at a certain point. I was able to get the effect to zoom from out to in just by changeing the z value from + to -but I’m clueless as to how to get it to stop. Can anyone help me with this issue? Thanks

have 2 values

  1. speed
  2. direction

Your speed is your speed of zoom. Lets say you want to zoom in or out at a speed of 3. Set speed to 3

Your direction dictates which way to zoom. This is a multiplier to your speed. It makes your speed go in whatever direction you want. Direction can have 3 values; 1, -1 and 0. 1 is zoom in at a rate of speeddirection or speed1 which is speed. -1 is zoom out at a rate of speeddirection or speed-1 which is -speed. And 0 is speed*0 which is 0 which is no speed meaning no zoom.

So, all you have to do to zoom in is set direction to 1, zoom out, set it to -1 and to stop, set it to 0.

Thanks, but I’m still confused. How do I get it t stop? Here is the AS I used:

onClipEvent (load)
{
z=1000;
zspeed=5;
fl=20;
}
onClipEvent(enterFrame)
{
scale=fl/(fl+z);
_xscale=_yscale=100*scale;
z-=zspeed;
}

It zooms in properly but it keeps going and zooms out. All I want is for it to zoom in in and stop. Thanks again.

onClipEvent (load) 
{
   z=1000; 
   zspeed=5; 
   fl=20; 
}
onClipEvent(enterFrame) 
{
   scale=fl/(fl+z); 
   _xscale=_yscale=100*scale; 
   z-=zspeed; 
   if ( forSomeReason ) zspeed = 0 ;
}

You’ll have to define what ‘forSomeReason’ corresponds to, of course :slight_smile:

Hey thanks for the info, but will you mind telling me what the “for some reason” would be? I’m not an expert with action script and I have tried a whole bunch of conditions that didnt work for me. For example:

if ( z = 100 ) zspeed = 0;
if (scale = 100) zspeed = 0;

but each time I tested it the movie it didnt even move. It stayed in the position, I think I’m writing the wrong conditions. Your help again will be appreciated. Thanks

if (z == 100) …

= is used to assign a value
== is used to test an equality

pom :slight_smile:

Hey THANKS :), thats exactly what I needed. I appreciate your help!