A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: water 2

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    27

    water 2

    ok i am using the followin action script and while i can copy and paste assign it to a movie and such beyond that i am action script illiterate so help would be greatly appreciated is there a way i can make this ripple not loop, and as the mouse drags across the movie a new ripple start like a tail kinda::

    xripple = 75;
    yripple = 60;

    Movieclip.prototype.Circle = function ( tl_x, tl_y, br_x, br_y, th, is_shadow ){
    this.lineStyle();

    var colors = [ 0xFFFFFF, 0, 0xFFFFFF ];
    var alphas = [ 0, 10, 0 ];
    var ratios = [ 0xBF, 0xDF, 0xFF ];
    var matrix = { matrixType:"box", r:0 };
    matrix.w = br_x-tl_x;
    matrix.h = br_y-tl_y;
    matrix.x = tl_x;
    matrix.y = tl_y;
    this.beginGradientFill( "radial", colors, alphas, ratios, matrix );

    var mx = ( tl_x + br_x ) / 2;
    var my = ( tl_y + br_y ) / 2;
    var cx = (br_x - tl_x) * .022;
    var cy = (br_y - tl_y) * .022;
    this.moveTo ( mx, tl_y );
    this.curveTo ( br_x-cx, tl_y+cy, br_x, my );
    this.curveTo ( br_x-cx, br_y-cy, mx, br_y );
    this.curveTo ( tl_x+cx, br_y-cy, tl_x, my );
    this.curveTo ( tl_x+cx, tl_y+cy, mx, tl_y );
    tl_x += th;
    tl_y += th;
    br_x -= th;
    br_y -= th;
    this.lineTo ( mx, tl_y );
    this.curveTo ( tl_x+cx, tl_y+cy, tl_x, my );
    this.curveTo ( tl_x+cx, br_y-cy, mx, br_y );
    this.curveTo ( br_x-cx, br_y-cy, br_x, my );
    this.curveTo ( br_x-cx, tl_y+cy, mx, tl_y );
    this.endFill();
    }

    for (var i=1;i<=4;i++){
    image.duplicateMovieClip("img"+i,i);
    createEmptyMovieClip("msk"+i,i+10);
    createEmptyMovieClip("shw"+i,i+20);
    img=eval("img"+i);
    msk=eval("msk"+i);
    shw=eval("shw"+i);
    img.setMask(msk);
    img._x=image._x-4; img._y=image._y+2;
    shw._x = msk._x=xripple;
    shw._y = msk._y=yripple;
    r = 140 + 40 * (i % 2);
    msk.Circle( -r,-r,r,r,50 );
    shw.Circle( -r,-r,r,r,50 );
    }

    onEnterFrame = function() {
    shw1._yscale = shw1._xscale = msk1._yscale = msk1._xscale = (msk1._xscale + 1.6) % 100;
    if (msk1._xscale >25 ) img1._alpha = (100 - msk1._xscale) * 4 / 3 else img1._alpha = msk1._xscale * 4;
    shw1._alpha = img1._alpha;

    shw2._yscale = shw2._xscale = msk2._yscale = msk2._xscale = (msk1._xscale + 25) % 100;
    if (msk2._xscale >25 ) img2._alpha = (100 - msk2._xscale) * 4 / 3 else img2._alpha = msk2._xscale * 4;
    shw2._alpha = img2._alpha;

    shw3._yscale = shw3._xscale = msk3._yscale = msk3._xscale = (msk1._xscale + 50) % 100;
    if (msk3._xscale >25 ) img3._alpha = (100 - msk3._xscale) * 4 / 3 else img3._alpha = msk3._xscale * 4;
    shw3._alpha = img3._alpha;

    shw4._yscale = shw4._xscale = msk4._yscale = msk4._xscale = (msk1._xscale + 75) % 100;
    if (msk4._xscale >25 ) img4._alpha = (100 - msk4._xscale) * 4 / 3 else img4._alpha = msk4._xscale * 4;
    shw4._alpha = img4._alpha;
    }

    stop();
    Tucker James

  2. #2
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    If you look in the tuts at the top of this page, find one for a mouse trailer. (One of those kind that follow a mouse curser around.) Then make the mouse trailer the ripple.
    Any programming language is at its best before it is implemented and used.

  3. #3
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    This is did while messing around at lunch. You can put in your actionscript in but it is very cpu intensive.
    Any programming language is at its best before it is implemented and used.

  4. #4
    Junior Member
    Join Date
    May 2002
    Posts
    27
    ok all these teach me how to do is make a movie or and object follow my mouse i need the as to follow it
    Tucker James

  5. #5
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    I am not sure I follow the question, but the actionscript is in the fun file.
    Any programming language is at its best before it is implemented and used.

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