# Elasticity and x/y

**URL:** <https://forum.kirupa.com/t/elasticity-and-x-y/19859>\
**Category:** Uncategorized\
**Created:** [May 2, 2003, 3:59am UTC](https://forum.kirupa.com/t/elasticity-and-x-y/19859 "2003-05-02T03:59:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zephn](https://avatars.discourse-cdn.com/v4/letter/z/5f8ce5/32.png) [@zephn](https://forum.kirupa.com/u/zephn)\
**Post date:** [May 2, 2003, 3:59am UTC](https://forum.kirupa.com/t/elasticity-and-x-y/19859/1 "2003-05-02T03:59:37Z")

</div>

This…

Movieclip.prototype.elasticMove = function(target, accel, convert) {  
step = step \* accel + (target - this.\_x) \* convert;  
this.\_x += step;  
}

is the code in the actions layer

This

onClipEvent (enterFrame) {

```
elasticMove(_root.newX, 0.7, 0.3)

```

}

onClipEvent(load){  
\_root.newX= 303;  
}

is the code on the mvie clip to relocate it on the x axis. A button would specify a new x position with this code  
on(release){  
\_root.newX=960;  
}

So I’m wondering how I can make it so this code also moves the movie clip on the y axis so i can have a diagonal move.  
Any takers?

---

<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:** [May 2, 2003, 4:05am UTC](https://forum.kirupa.com/t/elasticity-and-x-y/19859/2 "2003-05-02T04:05:51Z")

</div>

[http://downloads.junioronline.us/details.php?section=3&item=2](http://downloads.junioronline.us/details.php?section=3&item=2)

---

<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:** [May 2, 2003, 4:21am UTC](https://forum.kirupa.com/t/elasticity-and-x-y/19859/3 "2003-05-02T04:21:57Z")

</div>

amazing thank you… I was trying tofigure out how to add another target in there:)

---

<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:** [May 2, 2003, 4:27am UTC](https://forum.kirupa.com/t/elasticity-and-x-y/19859/4 "2003-05-02T04:27:03Z")

</div>

lol… it’s that simple 😉

nice to see a Canadian who hates hockey :beam:
