Vibration effect.....make more violent?

i have text which i have created to vibrate using this code

onClipEvent (load) {
// movie width/height
height = 150;
width = 500;
this._xscale = this._yscale=temp;
// setting initiaion position
cx = this._x;
cy = this._y;
}
onClipEvent (enterFrame) {
// causes the object to be offset
this._x = cx+(1+Math.random()*5);
this._y = cy+(1+Math.random()*5);
}

i edited it from the original kirupa tutorial on circle vibration, but does anyone know how to edit that so the vibration becomes more violent over time?

ty

-kipz

The magnitude of the vibration is given by the ‘5’ in the following lines:


    this._x = cx+(1+Math.random()*5);
    this._y = cy+(1+Math.random()*5);

If you modify the script as follows, the magnitude will increase with time.


onClipEvent (load) {
    // movie width/height
    height = 150;
    width = 500;
    this._xscale = this._yscale=temp;
    // setting initiaion position
    cx = this._x;
    cy = this._y;
    mag = 5;
}
onClipEvent (enterFrame) {

    mag = mag + 1;  // increase magnitutde

    this._x = cx+(1+Math.random()*mag);
    this._y = cy+(1+Math.random()*mag);
}

There are many ways you can increase the magnitude, besides adding 1.
Try this one instead:


   mag = mag * 1.2;

Also, you may want to try vibrating this way (to keep the oscillations centered)


    this._x = cx+Math.random()*mag - mag/2;
    this._y = cy+Math.random()*mag - mag/2;

  • Jim

hey jim thanks a lot thats a great help