[behavior] Twixt - A lightweight tween

Post your work in progress addons and get feedback

Post » Wed Jul 30, 2014 10:52 pm

Hey, folks. Here's my first go at the SDK. I needed a tween that could scale sprite fonts, and decided I wanted to take the code a different direction than LiteTween, so I wrote my own.

Twixt 0.53

Twixt_0.53.zip
(This is packaged as a c2addon, but this forum doesn't like that extension. Just rename it to Twixt_0.53.c2addon for drag-and-drop install.)

Twixt is optimized for efficient, linear tweens. Easing is not supported. It can tween position, size, scale, angle, opacity, and Sprite Font scale.

Note that tweening Texts is a bad idea! WebGL handles non-bitmap fonts in a very inefficient manner. If you need to tween text, make sure it's a Sprite Font. I recommend using Sprite Font Generator and SpriteFont+ to make them as painless as possible.

Also note that this is a beta preview. Anything may be broken or become broken at any time. Use with caution! (The 1.0 release should be forthcoming in the not-too-distant future.)

If you find any bugs or have any suggestions, just let me know!

Thanks. :)


Docs
Most of it should be self-explanatory, but here are some details.

Scale
When scaling a sprite, the internal scale system is used as if the SetScale action had been called. When scaling other objects, the basic width and height properties are used and their start values are used as scale factor 1.

Expressions
StartA - Start value for position X, size width, scale factor, angle degrees, opacity percent, or font scale.
StartB - Start value for position Y or size height. Ignored for scale, angle, opacity, and font.
EndA - End value, as above.
EndB - End value, as above.

State
Start - Tween is stopped at the start position.
Forward - Tween is running from the start to the end.
Paused - Tween is paused between the start and end positions.
Reverse - Tween is running from the end to the start.
End - Tween is stopped at the end position.


Changelog
08/09/2014 - 0.53 - Fixed tweening only Y or height with unchanged X or width
08/08/2014 - 0.52 - Fixed scale of flipped/mirrored sprites
08/08/2014 - 0.51 - Fixed scale reverse end detection
08/08/2014 - 0.5 - Changed debug tweened and state values to their text equivalents (instead of their constant index)
08/07/2014 - 0.4 - Added "scale" as a property to tween
08/01/2014 - 0.3 - Added a condition to check the tween state
07/31/2014 - 0.2 - Revamped configuration actions and expressions
07/30/2014 - 0.1 - Initial release
You do not have the required permissions to view the files attached to this post.
Last edited by TrickyWidget on Sat Aug 09, 2014 6:34 pm, edited 29 times in total.
B
8
S
2
Posts: 55
Reputation: 616

Post » Wed Jul 30, 2014 11:09 pm

It's quite nice, I like it.
Easy and simple.
One thing - could you add an action to set "two values" for target. For something like
Target X - mouse.X
Target Y - mouse.Y

Besides that it's nice simple plugin.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Thu Jul 31, 2014 1:09 pm

shinkan wrote:It's quite nice, I like it.
Easy and simple.
One thing - could you add an action to set "two values" for target. For something like
Target X - mouse.X
Target Y - mouse.Y

Besides that it's nice simple plugin.


Thanks!

I just overhauled the configuration actions. I realized that trying to set the tween properties individually would break things most of the time (oops), so I moved everything into two actions. There's "Configure", which is just like the editor properties. Then there's "Configure+" which allows one to set everything individually and from expressions. I think that's what you were looking for. :)

I also re-did the expressions to make them more meaningful.

Thanks for the feedback!
B
8
S
2
Posts: 55
Reputation: 616

Post » Thu Jul 31, 2014 1:39 pm

Yeah, that's it!
I really like Configure and Configure+ solution.

Keep it going!
Just one more thing, If your plugin is called Twixt it should have same name in C2 (for now it shows up as Tween) ;)
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Fri Aug 01, 2014 11:36 am

Just posted 0.3, which adds a condition to check the state of the tween. :)
B
8
S
2
Posts: 55
Reputation: 616

Post » Fri Aug 01, 2014 11:47 am

shinkan wrote:Yeah, that's it!
I really like Configure and Configure+ solution.

Keep it going!
Just one more thing, If your plugin is called Twixt it should have same name in C2 (for now it shows up as Tween) ;)


Thanks! Glad I could help. :)

The "Tween" name inside C2 is actually on purpose. I wanted a name that was consistent with the rest of the design experience. Texts are called Text and sprites are called Sprite, so similarly I thought tweens should be called Tween.
B
8
S
2
Posts: 55
Reputation: 616

Post » Fri Aug 01, 2014 12:14 pm

@TrickyWidget : It's quite elegant already! I'll wait to see how it evolves, but it will eventually be a nice supplementary tool to c2's arsenal.
B
79
S
22
G
4
Posts: 311
Reputation: 12,814

Post » Fri Aug 01, 2014 8:23 pm

Valerien wrote:@TrickyWidget : It's quite elegant already! I'll wait to see how it evolves, but it will eventually be a nice supplementary tool to c2's arsenal.


Thank you! It's nice to hear that it's shaping up to be a useful contribution. :)
B
8
S
2
Posts: 55
Reputation: 616

Post » Fri Aug 08, 2014 12:07 am

I just posted 0.4, which adds a "Scale" property to tween (see the docs for details).

Enjoy. :)
B
8
S
2
Posts: 55
Reputation: 616

Post » Fri Aug 08, 2014 2:13 pm

Thanks!
and like always some requests ;)
1. Action to stop tween (You can start, reset, reverse and pause only)
2. Debugger State value. I really like what you did in debugger, showing all available values is powerful. But for better visual sake could State show names instead of numbers? Like Start instead of 1, or Pause for 2 :)
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Next

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 1 guest