A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Shaking Text

  1. #1
    Junior Member
    Join Date
    Dec 2004
    Posts
    4

    Shaking Text

    Hey,

    I making a banner, and i want the title/main text to shake/vibrate. The banner has a sort of angry/rock feel to it. I tried using this code for some circles i wanted to vibrate on the text but it didn't work properly:


    onClipEvent (load) {
    // movie width/height
    height = 200;
    width = 300;
    // ------------------------//
    // makes everything random //
    // ------------------------//
    this._x = Math.round(Math.random()*width);
    this._y = Math.round(Math.random()*height);
    var temp = this._alpha=Math.random()*100;
    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);
    }
    onClipEvent (load) {
    _x = 0;
    _y = 0;
    speed = 5;
    }
    onClipEvent (enterFrame) {
    endX = _root._xmouse;
    endY = _root._ymouse;
    _x += (endX-_x)/speed;
    _y += (endY-_y)/speed;
    }


    Please help, i want the text to vibrate in the same principle as that but to stay in one place.

    Thanks.

  2. #2
    did0bib chero's Avatar
    Join Date
    Jun 2004
    Location
    in a bar, under the sea
    Posts
    751
    I've made some modifications, think this is what you're looking for. I left you //NOTE comments to clarify it further:

    code:

    onClipEvent (load) {
    // movie width/height
    height = 200;
    width = 300;

    /* NOTE: set these ._x and._y coordinates to position your clip where you want it
    It might take some experimenting*/
    this._x = 120;
    this._y = 120;
    // 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);
    }
    onClipEvent (load) {
    _x = 0;
    _y = 0;
    //NOTE: set desired speed (xperiment):
    speed = 2;
    }
    //NOTE : if you cut these out, then the mouse won't affect your MC:
    onClipEvent (enterFrame) {
    endX = _root._xmouse;
    endY = _root._ymouse;
    _x += (endX-_x)/speed;
    _y += (endY-_y)/speed;
    }


  3. #3
    Junior Member
    Join Date
    Dec 2004
    Posts
    4
    Thanks! Big help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center