# Vibration effect.....make more violent?

**URL:** <https://forum.kirupa.com/t/vibration-effect-make-more-violent/106546>\
**Category:** Uncategorized\
**Created:** [April 6, 2004, 9:28pm UTC](https://forum.kirupa.com/t/vibration-effect-make-more-violent/106546 "2004-04-06T21:28:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kipper](https://avatars.discourse-cdn.com/v4/letter/k/b9e5f3/32.png) [@Kipper](https://forum.kirupa.com/u/Kipper)\
**Post date:** [April 6, 2004, 9:28pm UTC](https://forum.kirupa.com/t/vibration-effect-make-more-violent/106546/1 "2004-04-06T21:28:17Z")

</div>

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

---

<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 6, 2004, 9:38pm UTC](https://forum.kirupa.com/t/vibration-effect-make-more-violent/106546/2 "2004-04-06T21:38:36Z")

</div>

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

```auto

    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.

```auto

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:

```auto

   mag = mag * 1.2;

```

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

```auto

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

```

- Jim

---

<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 6, 2004, 9:55pm UTC](https://forum.kirupa.com/t/vibration-effect-make-more-violent/106546/3 "2004-04-06T21:55:54Z")

</div>

hey jim thanks a lot thats a great help
