# Adding Ease

**URL:** <https://forum.kirupa.com/t/adding-ease/18843>\
**Category:** flash\
**Created:** [April 21, 2003, 9:05pm UTC](https://forum.kirupa.com/t/adding-ease/18843 "2003-04-21T21:05:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdipi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mdipi/32/49_2.png) [@mdipi](https://forum.kirupa.com/u/mdipi)\
**Post date:** [April 21, 2003, 9:05pm UTC](https://forum.kirupa.com/t/adding-ease/18843/1 "2003-04-21T21:05:15Z")

</div>

ok i made this file [[link](http://www.mdipi.com/sorry/grow.html)] and want to make the "growing a bit smoother. i dont know how to add easing or interia (i cant spell or put my hand on the name) so can some one help? plz?:beam:

---

<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:** [April 21, 2003, 9:10pm UTC](https://forum.kirupa.com/t/adding-ease/18843/2 "2003-04-21T21:10:03Z")

</div>

the link is loadng hella slow so here is the attached fla:

:-\

---

<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:** [April 21, 2003, 9:14pm UTC](https://forum.kirupa.com/t/adding-ease/18843/3 "2003-04-21T21:14:47Z")

</div>

gimme 5 minutes i’ll do it for ya 🙂

---

<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:** [April 21, 2003, 9:24pm UTC](https://forum.kirupa.com/t/adding-ease/18843/4 "2003-04-21T21:24:20Z")

</div>

there you go 🙂

```auto
function grow() {
	originalSizeY = _yscale+15;
	originalSizeX = _xscale+15;
	onEnterFrame = function () {
		differenceY = originalSizeY-_yscale;
		differenceX = originalSizeX-_xscale;
		(Math.floor(differenceY) == 0) ? delete this.onEnterFrame : _yscale += differenceY/3;
		(Math.floor(differenceX) == 0) ? delete this.onEnterFrame : _xscale += differenceX/3;
	};
}

```

---

<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:** [April 21, 2003, 9:25pm UTC](https://forum.kirupa.com/t/adding-ease/18843/5 "2003-04-21T21:25:28Z")

</div>

sweet! thanks. i just chame my grow funtion out

---

<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:** [April 21, 2003, 9:27pm UTC](https://forum.kirupa.com/t/adding-ease/18843/6 "2003-04-21T21:27:35Z")

</div>

```auto
(Math.floor(differenceY) == 0) ? delete this.onEnterFrame : _yscale += differenceY/3;
                (Math.floor(differenceX) == 0) ? delete this.onEnterFrame : _xscale += differenceX/3;

```

ahmed can you break that part down for me? i dont quite get whats going on…

---

<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:** [April 21, 2003, 9:42pm UTC](https://forum.kirupa.com/t/adding-ease/18843/7 "2003-04-21T21:42:02Z")

</div>

```auto
_yscale += differenceY/3;
_xscale += differenceX/3;

```

this part is responsible for the easing. Let’s say the \_xscale is 100, and you want it to be 120, what you would do it:

```auto

1. calculate 120-_yscale> store that in the variable 'difference' ( gives '20' )
2. add difference/3 ( adds '20/3' )
3. goto 1 >> 1. calculate 120-_yscale> store that in the variable 'difference' ( gives '13' )
             2. add difference/3 ( adds 13/3 )

```

… and so on… thus, you get the easing effect.

the other part is simply to check whether it has reached the desired size, if it did, it deletes the onEnterFrame function 🙂

i know it’s not that clear, but i hope you get the general idea 🙂

---

<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:** [April 21, 2003, 9:49pm UTC](https://forum.kirupa.com/t/adding-ease/18843/8 "2003-04-21T21:49:16Z")

</div>

yep i get it now, i was really confused w/the last part cause i dont know that much yet
