[behavior] Tween (tween.js and bezier-easing)

0 favourites
  • 11 posts
From the Asset Store
Calculate parabolic trajectories and tween objects over them.
  • I wanted a simple tween behavior to return a tween value for easy use in events. I also wanted bezier curve easing for full control of the a tween curve. I also enjoy the challenge of learning javascript, so I combined Easing.js and this Bezier-Easing javascript library.

    Feel free to use this in your projects: Tween on GitHub.

    If you find any bugs etc then let me know here or on github. I hope you find this useful .

    Actions:

    One-stop set up easing tween

    One-stop set up bezier tween

    Set up bezier tween light (values 0 to 1 returned)

    Pause / resume tween

    Reset and restart tween

    Reverse tween

    Dynamically alter bezier control point values

    Conditions:

    On end trigger

    Is tweening

    Expressions:

    Progress (0 to 1)

    Current tween value

    Get value at a specified time (time 0 to 1). Use this to loop through 0 to 1 and derive the tween values, to draw curves or predict movement etc.

    NB the control point values are entered as decimal fractions (not real world coords), as shown here and detailed here.

  • Mate, this is pretty cool - exactly what I was looking for, thank you

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Actually Colludium, just one minor bug for you.

    The 'On End' event fires continuously once it's hit - In your runtime.js file line 483 it has:

    if (this.currentProfile == 0 && this.progress > 0.99999)

    I think it should be:

    if (this.isTweening && this.currentProfile == 0 && this.progress > 0.99999)

    Seems to fix it, but I'm not sure if it breaks anything else

    Loving this behaviour, cheers!

  • Zacros - thanks for the bug fix (more adjusting was required than in your suggestion, so please download the plugin again)! I've updated the repository, including minor (non-breaking) changes to the edittime.js, to make it easier to read.

    Glad you like it!

  • Colludium That is a very interesting behaviour, thanks.

    I was hoping for a long time, someone integrated a Bezier easing

    Now I use LiteTween behavior for a while but it had some bugs and I will give yours a try

    By the way, you're missing the Linear Tween type when you setup the Tween

  • Thanks Cipriux! I'll add the linear type tween asap.

  • Cipriux, please download the plugin again. I've added a linear tween option.

  • Colludium Thank you, Bender. Good karma for you

  • I cant use this plugin :c

    what is happening?

  • Tween is a Behaviour, not a Plugin - you've put it in the wrong directory - move it to "behaviors".

  • Tween is a Behaviour, not a Plugin - you've put it in the wrong directory - move it to "behaviors".

    I just realized it, sorry

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)