# Voetsjoeba, help with golden formula...?

**URL:** https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403
**Category:** Uncategorized
**Created:** [August 9, 2004, 4:45pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403 "2004-08-09T16:45:02Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![l2edsand](https://avatars.discourse-cdn.com/v4/letter/l/ecd19e/32.png) [@l2edsand](https://forum.kirupa.com/u/l2edsand)
#### Post date: [August 9, 2004, 4:45pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/1 "2004-08-09T16:45:02Z")

</div>

\*Bonjour…

I am in need of easing… and since your formula is so golden, Voetsjoeba, I’d like to ask… how do i apply it? if there a way you can create a sample .fla for me?

My goal is to movie a mask to a certain point with easing and when it has reached that destination, execute some other movieclips…

Any help would be greatly appreciated! And soon… I shall be calling you the golden child!

Devin\*

---

<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: [August 9, 2004, 5:27pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/2 "2004-08-09T17:27:24Z")

</div>

```php

onClipEvent (load) {
	// set some vars
	speed = 10;
	minDistance = this._width/2;
	to_far_away = true;
}
onClipEvent (enterFrame) {
	// ease the object towards the mouse if its to far away
	if (to_far_away) {
		this._x += (_root._xmouse-this._x)/speed;
		this._y += (_root._ymouse-this._y)/speed;
	}
	
	// calculate the distance from object to mouse
	ab = Math.abs(this._x-_root._xmouse);
	bc = Math.abs(this._y-_root._ymouse);
	distance = Math.sqrt(ab*ab+bc*bc);
	
	// compare distance to allowed minimal distance
	if (distance<=minDistance) {
		to_far_away = false;
	} else {
		to_far_away = true;
	}
}

```

check out .fla for results… (-:

---

<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: [August 9, 2004, 7:02pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/3 "2004-08-09T19:02:55Z")

</div>

Are you looking for some kind of sequence?  
This example is simple (just the x axis)

```auto
var d = 0;
var amount = 4;
MovieClip.prototype.easeIn = function(tarX) {
	this.onEnterFrame = function() {
		this._x = tarX-(tarX-this._x)/1.2;
		if (Math.abs(this._x-tarX)<1) {
			nextMc();
			delete this.onEnterFrame;
		}
	};
};
function nextMc() {
	if (d<amount) {
		d++;
		this["mc"+d].easeIn(450);
	}
}
nextMc();

```

scotty(-:

---

<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: [August 9, 2004, 7:26pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/4 "2004-08-09T19:26:19Z")

</div>

Yup, scotty pretty much said it. It’s a MovieClip prototype, so you can just apply it like you’d apply gotoAndPlay(5): themovieclip.easeTo(52) for example. If you have one with two axis movements and thus 2 arguments, then it’d be themovieclip.easeTo(63,59) for example. Of course, these numbers are only examples.

---

<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: [August 10, 2004, 2:28am UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/5 "2004-08-10T02:28:30Z")

</div>

That is great Scotty!!!

---

<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: [August 10, 2004, 5:36am UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/6 "2004-08-10T05:36:18Z")

</div>

LOL, everything with Voets’ golden formula is great:lol:

scotty(-:

---

<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: [August 10, 2004, 4:40pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/7 "2004-08-10T16:40:02Z")

</div>

Hmmm… I see the result, but I’m still trying to understand all of the actionscript commands… So, from what I understand Voet, is that once that statement is executed in flash, you can just use it in a simple button action:

on (release) {  
mc1.easeTo(63);  
}

But, I see from my own testing that this isn’t working… I’m missing something… I don’t mean to be a pain, but I really appreciate your help!

---

<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: [August 10, 2004, 4:45pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/8 "2004-08-10T16:45:59Z")

</div>

Right, well… it certainly shows that I am not a morning person… I just assumed that “easeTo” was the naming convention that was used in the fla… ha, well… now that I’ve figured out why it didn’t work for me, it makes sense… how embarrassing :trout:

…Now, two more things… 1) which part of this statement could i get rid of if I didn’t want the MC to move as soon as the .swf started playing? This?:

function nextMc() {  
if (d\<amount) {  
d++;  
this[“mc”+d].easeIn(450);  
}  
}  
nextMc();

1. If i wanted to create the Y property too, would I just copy the same code and change all of the X values to “Y”?

---

<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: [August 11, 2004, 12:03am UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/9 "2004-08-11T00:03:40Z")

</div>

Sorry for the delay, as you can see in my user title I’ve been very busy lately.

> [@l2edsand](#):
>
> Hmmm… I see the result, but I’m still trying to understand all of the actionscript commands… So, from what I understand Voet, is that once that statement is executed in flash, you can just use it in a simple button action:
> 
> on (release) {  
> mc1.easeTo(63);  
> }

Yes, once the prototype code has been executed, you can use it all over your movie 🙂

> [@l2edsand](#):
>
> 1. which part of this statement could i get rid of if I didn’t want the MC to move as soon as the .swf started playing? This?:
> 
> function nextMc() {  
> if (d\<amount) {  
> d++;  
> this[“mc”+d].easeIn(450);  
> }  
> }  
> nextMc();

Get rid of the nextMc(). That line actually executes the function which you defined above. If you don’t execute it, it won’t do no nothing, so take away the line that executes it 🙂

> [@l2edsand](#):
>
> 1. If i wanted to create the Y property too, would I just copy the same code and change all of the X values to “Y”?

No, but you would add similar code to it like the code that’s already in it. Here’s the prototype for 2 axis easing:

```auto

MovieClip.prototype.easeIn = function(tarX,tarY) {
     this.onEnterFrame = function() {
         this._x = tarX-(tarX-this._x)/1.2;
         this._y = tarY-(tarY-this._y)/1.2;
         if (Math.abs(this._x-tarX)<1 && Math.abs(this._y-tarY)<1) {
             this._x = tarX;
             this._y = tarY;
             delete this.onEnterFrame;
         }
     };
 };
  

```

---

<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: [August 11, 2004, 5:14pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/10 "2004-08-11T17:14:02Z")

</div>

Alright, that’s what I thought… now if I wanted to tell a movieclip to go to a certain point using the Y axis, how would I do that?

using this function:

on (release) {  
mask.easeIn(500);  
}

…uses the X axis only… so how would I tell the movie clip to move along the Y axis?

Thank you very much, Voet! I appreciate all of your guys help with my issues… This website is by far the best Flash tutorial site I have found… and th forums don’t hurt either 😉 Once again, thank you!

Devin

---

<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: [August 11, 2004, 5:45pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/11 "2004-08-11T17:45:14Z")

</div>

Ok… just looking through the code and familiarizing myself with how it’s built, i tested this code:

on (release) {  
mask.easeIn(x,100);  
}

…and this worked for me… i’m not sure if replacing the Xaxis with a simple letter is the way to go, but that worked… Am I wrong?

---

<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: [August 11, 2004, 8:48pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/12 "2004-08-11T20:48:52Z")

</div>

…ok… Voet… I think this will be the last request… I’ve figured out how to manipluate the X and Y with easing - your golden formula is nothing short of it’s reputation. Now! How can I add in changing the Width and Height within this formula too!? That is my final request on this subject… at least for now…

Thank you again,

Devin

---

<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: [August 11, 2004, 9:07pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/13 "2004-08-11T21:07:05Z")

</div>

Alright everyone… through the evolution of this topic I have been helped in numerous ways… To answer my own question I have manipulated Voets Golden Formula to effect the \_x, \_y, \_width, and \_height. For all the nubs that are in my former shoes, here’s the answer (of course, there could be some tweaks):

MovieClip.prototype.easeIn = function( tarX, tarY, nWidth, nHeight )  
{  
this.onEnterFrame = function()  
{  
this.\_x = tarX - ( tarX-this.\_x ) / 1.2;  
this.\_y = tarY - ( tarY-this.\_y ) / 1.2;  
this.\_width = nWidth - ( nWidth - this.\_width ) / 1.2;  
this.\_height = nHeight - ( nWidth - this.\_height ) / 1.2;  
trace(this.\_width);  
if ( Math.abs( this.\_width - nWidth ) \< 1 && Math.abs( this.\_height - nHeight ) \< 1 )  
{  
trace(“do it”);  
this.\_width = nWidth;  
this.\_height = nHeight;  
}

if ( Math.abs( this.\_x - tarX ) \< 1 && Math.abs( this.\_y-tarY ) \< 1 )  
{  
this.\_x = tarX;  
this.\_y = tarY;  
delete this.onEnterFrame;  
}  
};  
};

I love it!

Sincerely,

Devin

---

<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: [August 11, 2004, 9:46pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/14 "2004-08-11T21:46:13Z")

</div>

Hey l2edsand!  
I am try to put it together and I am having some prob’s?? Can you maybe help me out, or post a .fla with your example? Thanks mang!!!

---

<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: [August 12, 2004, 6:08am UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/15 "2004-08-12T06:08:36Z")

</div>

Isn’t it better to combine the two if statements?  
Cause if the difference between x/y and tarX/tarY is small, the onEnterFrame will be deleted, before you reach the chosen width/height;)

```auto
MovieClip.prototype.easeIn = function(tarX, tarY, nWidth, nHeight) {
	this.onEnterFrame = function() {
		this._x = tarX-(tarX-this._x)/1.2;
		this._y = tarY-(tarY-this._y)/1.2;
		this._width = nWidth-(nWidth-this._width)/1.2;
		this._height = nHeight-(nWidth-this._height)/1.2;
		trace(this._width);
		if (Math.abs(this._width-nWidth)<1 && Math.abs(this._height-nHeight)<1 && Math.abs(this._x-tarX)<1 && Math.abs(this._y-tarY)<1) {
			trace("do it");
			this._width = nWidth;
			this._height = nHeight;
			this._x = tarX;
			this._y = tarY;
			delete this.onEnterFrame;
		}
	};
};

```

scotty(-:

---

<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: [August 12, 2004, 10:18am UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/16 "2004-08-12T10:18:21Z")

</div>

Oh, well done l2edsand ! It’s not perfect, but you definitely were going the right way ! You can pretty much ease anything that way, that’s why I called it “my golden formula” just for kicks before, and it kept that name although that wasn’t intended :lol:

---

<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: [August 12, 2004, 5:02pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/17 "2004-08-12T17:02:45Z")

</div>

Morning guys… Well morning here.

I am try to do this effect [http://www.exopolis.com/site/](http://www.exopolis.com/site/) it steams like sequence with the Golden formula? Don’t know?  
Thanks guys!!!

---

<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: [August 13, 2004, 8:18pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/18 "2004-08-13T20:18:32Z")

</div>

Hey Flash,

Copy and paste scotty’s simplified, sexy code into your first keyframe on the top layer (rename it “golden”):

MovieClip.prototype.easeIn = function(tarX, tarY, nWidth, nHeight) {  
this.onEnterFrame = function() {  
this.\_x = tarX-(tarX-this.\_x)/1.2;  
this.\_y = tarY-(tarY-this.\_y)/1.2;  
this.\_width = nWidth-(nWidth-this.\_width)/1.2;  
this.\_height = nHeight-(nWidth-this.\_height)/1.2;  
trace(this.\_width);  
if (Math.abs(this.\_width-nWidth)\<1 && Math.abs(this.\_height-nHeight)\<1 && Math.abs(this.\_x-tarX)\<1 && Math.abs(this.\_y-tarY)\<1) {  
trace(“do it”);  
this.\_width = nWidth;  
this.\_height = nHeight;  
this.\_x = tarX;  
this.\_y = tarY;  
delete this.onEnterFrame;  
}  
};  
};

Then, create a square and convert it into a movie clip… give it an instance name of whatever you want (i.e. “mc” without quotes). then… you can create a button. once the button symbol is created drag it onto the stage if it isn’t there already and click on it - open up the actions panel and paste this code into it:

on (release) {  
mc.easeIn(10,50,350,40);  
}

That should take your box mc and move it to the x,y corodinates of 10 and 50 and change the size of it to 350x40… just play around with it… it’s really simple after a while. And if you need to, take a glance through the code to familiarize yourself with what’s actually being done there.

I hope that helps!

Devin

---

<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: [August 13, 2004, 8:25pm UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/19 "2004-08-13T20:25:49Z")

</div>

Hey l2edsand,

Thanks so much for that!! Man that is really cool!! 😉

---

<div class="post-metadata">

### Author: ![jdesign](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jdesign](https://forum.kirupa.com/u/jdesign)
#### Post date: [April 24, 2006, 7:26am UTC](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403/20 "2006-04-24T07:26:31Z")

</div>

Hi i’m trying to use this great prototype.  
but stuck in one thing…

What i want to do is.  
1.the Mc goes to designated point  
2. it’s being yscaled  
3. rotating ( [COLOR=Red]\_rotation +=2[/COLOR] )

step 1 and two is ok, but step 3 is not working,  
What am i’m doing wrong with this AS ? it’s prob something simple.  
I’m new with this prototype thing, just stumbled accross it 3 days ago 🙂  
would be great if someone could direct me, been stuck for 10 hours now ☹

MovieClip.prototype.easeIn = function(x, y) {  
this.onEnterFrame = function() {  
this.\_x = x-(x-this.\_x)/1.1;  
this.\_y = y-(y-this.\_y)/1.1;  
if (this.\_x\>x-1 && this.\_x\<x+1 && this.\_y\>y-1 && this.\_y\<y+1) {  
this.\_x = x;  
this.\_y = y;  
//startin yscle  
\_yscale = 50;  
}  
this.onEnterFrame = function() {  
\_yscale += (50-\_yscale)/10;

```
    };

```

[COLOR=Red] this.\_rotation += 5;[/COLOR]

```
    //do other stuff here, this is the point at which the object reaches its target
};

```

};

[Next page](https://forum.kirupa.com/t/voetsjoeba-help-with-golden-formula/60403.md?page=2)
