[Behavior] LiteTween

Post your completed addons to share with the community

Post » Wed Sep 18, 2013 3:26 am

Thank you, @lunarray!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Wed Sep 18, 2013 2:46 pm

[QUOTE=ghost] @wizaerd
AFAIR it's a behaviour[/QUOTE]

d'oh.... thanx, I'll put it in the behaviors folder then. Thanx.
B
12
S
5
Posts: 133
Reputation: 1,483

Post » Thu Sep 19, 2013 3:45 am

I know I'm late to the party, but this behavior is awesome. Thank you!
ImageImageImage
B
38
S
5
G
4
Posts: 79
Reputation: 5,355

Post » Thu Sep 19, 2013 3:27 pm

[QUOTE=lunarray] @jayderyu:
Okie, already updated the litetween with that suggestion. Also removed a stray 'console.log' which make it unable to run on a version of internet explorer.

@Rhindon:
I made a simple manual for you
Manual PDF[/QUOTE] To help newcomers I'd suggest adding it to the 1st post. Thanks
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Sat Sep 21, 2013 2:49 am

Is it possible to "tag" a tween? For example, I have a spritefont object with a position tween. In one part of my program I am doing a staged tween where the object should move to point A, pause for a second, then move to point B, then return home.

To keep my code simple, I would like to use the "on tween end" trigger. However, without a tag, the code won't distinguish between the tween ending at point A and point B.

I know I can simply create two position tween behaviors and name them differently. That's ok, but I may have many instances like this in the program and it would be nice to not have to add many instances of the behavior.

Also, I can probably put an instance variable on the spritefont and check for the state of that variable in the "on tween end" condition. Again, I'm ok going that route too, but if tagging is an option, maybe that's the cleanest way?

Perhaps I'm looking at this wrong? Thanks!
ImageImageImage
B
38
S
5
G
4
Posts: 79
Reputation: 5,355

Post » Sat Sep 21, 2013 4:35 am

@clrammer

I know how inconvenient it is for doing things like that, but that is kinda how we should do thing in C2.

The very first version of LiteTween accepts multiple tween on one behavior, like you can put 'PosTweenA' as tween name and it'll trigger correct OnEnd event respectively. It is neat and I personally liked it, but turns out that it is not easy to grasp that concept to some and it introduces 'hidden properties'. What I mean by hidden properties is those properties you can't see on design sheet, it will be modified on runtime (not very user friendly for artists usually). So the final decision is removing that 'complexity' and let C2 handles that for us.

I personally do not know the impact or overhead on performance of having so many behaviour on one object.

How about using a state machine behavior to control the tween, and put relevant code bout it in a code group (to keep event sheet tidy)?
B
33
S
6
G
1
Posts: 179
Reputation: 3,628

Post » Sat Sep 21, 2013 4:56 pm

@lunarray

Thank you for the response. It all makes sense and I will likely go the state machine behavior route.

Thanks again for the great behavior!
ImageImageImage
B
38
S
5
G
4
Posts: 79
Reputation: 5,355

Post » Sat Sep 21, 2013 6:19 pm

Actually, another question.

Any ideas on how I can tween the scale of a sprite font? Size doesn't actually change the text size. I need to manipulate the "character scale" attribute of the sprite font.

My current implementation uses lerp, but of course the allure of the LiteTween behavior is to cut out as much of my lerp code as possible. I really, really like being able to kick off a tween and just wait for the "on end" trigger as opposed to tracking the lerp status every tick :)

Thanks!

EDIT: Never mind, I answered my own question by using tween value. That's what it's there for :)clrammer2013-09-21 21:43:26
ImageImageImage
B
38
S
5
G
4
Posts: 79
Reputation: 5,355

Post » Wed Oct 02, 2013 1:14 am

Hello! I'm having some trouble with this behavior that could be just me misinterpreting how it works.

I'm using it to tween the height of a sprite based on another instance variable, but the resulting height of the sprite does not match up with the target height that I set in the event sheet.

.capx here: http://storage.wertle.com/construct2/LiteTweenIssue.capx

Basically you steer the red block to pick up purple blocks, then go over and drop them in the bucket. Then I tween the meter, setting the target height to be the number of things the bucket contains.

However, the resulting height of the tween is not the target height, so I'm a little confused as to where it is getting its target height. Please advise!

(as a side note, I tried to print the LiteTween.Target property and got a js error in Chrome, i left the line in but disabled it if you want to see)

EDIT: Notice that if you change the tweened property to Size it seems to scale as expected, but if you use Height, it seems to scale up an arbitrary number that is not related to the set target value.Wertle2013-10-02 17:15:38
B
9
S
2
Posts: 87
Reputation: 1,051

Post » Thu Oct 03, 2013 12:36 am

@Wertle:
Ah yes, it was my bad, forgot to change the height portion of the code for the tween :( I think this one fixed it, I fixed the litetween to the latest version, can you try it again?

updated

PS: also fixed the Target propertylunarray2013-10-03 00:37:45
B
33
S
6
G
1
Posts: 179
Reputation: 3,628

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests