pukka
04-13-2003, 07:03 PM
ok, so i have a mouse trail, it works fine, but i wanted to add some elasticity to it. How do i do it? i took the code from 2 different tutorials:
Elasticity:
onClipEvent(load){
k=.2;
damp=.9;
}
onClipEvent(enterFrame){
ax=(_root._xmouse -_x)*k;
ay=(_root._ymouse -_y)*k;
vx+=ax;
vy+=ay;
vx*=damp;
vy*=damp;
_x+=vx;
_y+=vy;
}
And mouse trail
onClipEvent (mouseMove) {
if (i >= 100) {
i = 0
}
i++;
this.duplicateMovieClip("star"+i, i+10);
_root["star"+i]._x = _root._xmouse;
_root["star"+i]._y = _root._ymouse;
}
onClipEvent (enterFrame) {
if (this._name == "starParent") {
_visible = 0;
} else {
this._alpha -= 5;
this._rotation += 2;
this._xscale -= 5;
this._yscale -= 5;
if (this._alpha<=5) {
removeMovieClip(this);
}
}
}
Is there a way i can merge these two so the original image "star" is elasticated without the trail being elasticated? HELP!
I was thinking about changing the root of the trail to the instance of a duplicate of the original "star" (below) and make the duplicate
elasticated to the mouse.
this.duplicateMovieClip("star"+i, i+10);
_root["star"+i]._x = _root._xmouse;
_root["star"+i]._y = _root._ymouse;
This would work (i think). But i would need to puton these same effects onto the duplicate MC.
onClipEvent (enterFrame) {
if (this._name == "starParent") {
_visible = 0;
} else {
this._alpha -= 5;
this._rotation += 2;
this._xscale -= 5;
this._yscale -= 5;
if (this._alpha<=5) {
removeMovieClip(this);
}
}
}
Which is no problem but i don't know how to do the bit above
Ok, now HELP!
Elasticity:
onClipEvent(load){
k=.2;
damp=.9;
}
onClipEvent(enterFrame){
ax=(_root._xmouse -_x)*k;
ay=(_root._ymouse -_y)*k;
vx+=ax;
vy+=ay;
vx*=damp;
vy*=damp;
_x+=vx;
_y+=vy;
}
And mouse trail
onClipEvent (mouseMove) {
if (i >= 100) {
i = 0
}
i++;
this.duplicateMovieClip("star"+i, i+10);
_root["star"+i]._x = _root._xmouse;
_root["star"+i]._y = _root._ymouse;
}
onClipEvent (enterFrame) {
if (this._name == "starParent") {
_visible = 0;
} else {
this._alpha -= 5;
this._rotation += 2;
this._xscale -= 5;
this._yscale -= 5;
if (this._alpha<=5) {
removeMovieClip(this);
}
}
}
Is there a way i can merge these two so the original image "star" is elasticated without the trail being elasticated? HELP!
I was thinking about changing the root of the trail to the instance of a duplicate of the original "star" (below) and make the duplicate
elasticated to the mouse.
this.duplicateMovieClip("star"+i, i+10);
_root["star"+i]._x = _root._xmouse;
_root["star"+i]._y = _root._ymouse;
This would work (i think). But i would need to puton these same effects onto the duplicate MC.
onClipEvent (enterFrame) {
if (this._name == "starParent") {
_visible = 0;
} else {
this._alpha -= 5;
this._rotation += 2;
this._xscale -= 5;
this._yscale -= 5;
if (this._alpha<=5) {
removeMovieClip(this);
}
}
}
Which is no problem but i don't know how to do the bit above
Ok, now HELP!