# Perspective with a twist

**URL:** <https://forum.kirupa.com/t/perspective-with-a-twist/25933>\
**Category:** flash\
**Created:** [July 17, 2003, 7:27pm UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933 "2003-07-17T19:27:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flash\_Jester](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@Flash\_Jester](https://forum.kirupa.com/u/Flash_Jester)\
**Post date:** [July 17, 2003, 7:27pm UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/1 "2003-07-17T19:27:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 17, 2003, 10:59pm UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/2 "2003-07-17T22:59:10Z")

</div>

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 speed_direction or speed_1 which is speed. -1 is zoom out at a rate of speed_direction 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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2003, 3:05am UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/3 "2003-07-18T03:05:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2003, 10:04am UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/4 "2003-07-18T10:04:36Z")

</div>

```auto
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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2003, 3:11pm UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/5 "2003-07-18T15:11:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2003, 4:12pm UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/6 "2003-07-18T16:12:38Z")

</div>

if (z == 100) …

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

pom 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 11:02pm UTC](https://forum.kirupa.com/t/perspective-with-a-twist/25933/7 "2003-07-20T23:02:48Z")

</div>

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