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

Post your completed addons to share with the community

Post » Sun Feb 19, 2017 10:11 pm

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.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,193

Post » Sun Apr 16, 2017 12:45 am

Mate, this is pretty cool - exactly what I was looking for, thank you :)
B
7
S
1
G
1
Posts: 16
Reputation: 1,109

Post » Mon Apr 17, 2017 4:35 am

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!
B
7
S
1
G
1
Posts: 16
Reputation: 1,109

Post » Mon Apr 17, 2017 6:30 am

@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! :)
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,193


Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest