[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.
Learning other engines, but C2 still rocks. Image Image Image Image
B
80
S
22
G
95
Posts: 2,422
Reputation: 57,681

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! :)
Learning other engines, but C2 still rocks. Image Image Image Image
B
80
S
22
G
95
Posts: 2,422
Reputation: 57,681

Post » Sat Oct 07, 2017 8:10 am

@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
B
90
S
23
G
23
Posts: 545
Reputation: 19,187

Post » Sat Oct 07, 2017 8:22 am

Thanks @Cipriux! I'll add the linear type tween asap.
Learning other engines, but C2 still rocks. Image Image Image Image
B
80
S
22
G
95
Posts: 2,422
Reputation: 57,681

Post » Sat Oct 07, 2017 9:23 am

@Cipriux, please download the plugin again. I've added a linear tween option. :)
Learning other engines, but C2 still rocks. Image Image Image Image
B
80
S
22
G
95
Posts: 2,422
Reputation: 57,681

Post » Sat Oct 07, 2017 10:41 am

@Colludium Thank you, Bender. Good karma for you ;)
B
90
S
23
G
23
Posts: 545
Reputation: 19,187

Post » Sun Oct 08, 2017 12:54 am

Image

I cant use this plugin :c

what is happening?
B
52
S
20
G
7
Posts: 55
Reputation: 7,055

Post » Sun Oct 08, 2017 1:24 am

Tween is a Behaviour, not a Plugin - you've put it in the wrong directory - move it to "behaviors".
ImageImageImage
B
72
S
22
G
288
Posts: 3,862
Reputation: 158,460

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest