A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Can anyone help me with a bounceTo function?

  1. #1
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626

    Can anyone help me with a bounceTo function?

    Hello,

    I'm trying to write a function which makes a movieclip bounce to a certain position.

    All I've come up with is a bit of trig which moves the clip up and down while gradually shifting the 'base' y position and a straight tween on the x axis.

    But it just looks like a ball going up and down along a path, and not like it bouncing into position.

    Anyone got any ideas?

    cheers.
    New sig soon

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    I'm not sure what exactly you're tryna do but I can suggest you using a Tween to do the bouncing.
    You can find a lot about using tweens here:
    http://www.republicofcode.com/tutori...as3tweenclass/

    I find tweens the most applicable and easiest way to do the jobs like this

  3. #3
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    Thanks caseyryan,

    I'd completely forgotten about this thread and had figured it out already (using tweens).

    I can post the code up as it's now too integrated with the rest of my code base, but it general idea is as follows.

    The x axis of the movement was tweened using a straight, non-eased, tween. Then calculate how many bounces I want based on the distance of the tween, and create a separate tween for the up and down motion of each bounce. Eased in the eased out to put some pseudo gravity in there.
    Then I just stitched the tweens together using a tween timeline manager.

    I used the greensock Tweenlite and Timeline libraries.

    Cheers,

    Z.
    New sig soon

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