[Tweener] Instant tween

Archont archont at gmail.com
Wed Aug 6 11:39:00 PDT 2008


Amazing I didn't see the base property before. That would probably
save me around 200 lines of code by now. A big thanks to you mate.

I could write an application-specific function, but I'd rather have a
general-purpose one. The point is I put a configuration section with
private static const variables in one place - so that if my client
suddenly wants a totally different animation I have but one place to
change. Accounting for all possible arguments would be impractical, it
would make more sense just to filter out the tweener ones. As such I
might eventually write a Tweener extension to do just that, unless one
is already done.

Filtering against all tweener properties might be costly though. It
should be faster than letting Tweener do all it's checks and functions
though.

On Wed, Aug 6, 2008 at 8:30 PM, Zeh Fernando <zeh at zehfernando.com> wrote:
>> I'm pretty certain this has been asked already as it looks like a
>> useful feature. I did take a look around but didn't quite find the
>> answer though.
>>
>> What I'd use is a quick function that takes the parameters of a
>> tweening object, ignores all Tweener-specific ones (time, transition,
>> _color, _bezier...) and instantly applies the values without having to
>> go through all the needless Tweener code.
>>
>> As far as I've peeked in the code Tweener already does this, however
>> there are two disadvantages. The first is that I use private static
>> const objects to store all the tweening parameters. If I want an
>> instant tween I have to clone the objects via a quick bytearray
>> function and set the time to zero - not so quick if you're doing it en
>> masse. The second disadvantage is that I'm kind of strict about my
>> code and using Tweener to _instantly_ change the parameters isn't
>> immediately obvious.
>>
>
> You could do it with .base:
>
> mytween = {x:10, time:1, etc}
>
> Tweener.addTween(myobj, {base:mytween, time:0});
>
> With the second point - I agree. I don't think there's any better/simple way
> to do it though. Because Tweener has to go through some verification for the
> on* functions and whether it's an special property or not, it's not just a
> case of looping through the properties and applying them immediately.
>
> In any case, Tweener kind of "understands" it's a immediate change if time
> is 0 so it bypasses some unnecessary code so other than the slight
> syntactical inadequacy, I don't think there's a lot of trouble created by
> using it. A separate function could be used to set the values (if you don't
> use any special property) in a much cleaner way though, but I bet that'd
> work better as part of your application.
>
> Zeh
> _______________________________________________
> Tweener mailing list
> Tweener at lists.caurinauebi.com
> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
>



-- 
Pozdrawiam / Regards

Jacek "archont" Janiszewski
Samwise Interactive


More information about the Tweener mailing list