[Golist] HydroTween Updates/Post

Moses Gunesch moses at goasap.org
Wed May 14 08:46:50 PDT 2008


Can I make a couple more little code suggestions?

First, break out the _init routine into a private init() method.
Cleaner to read, easier to repurpose, better OO practice – all of  
which go a long way with shared code.
I know, I'm one to talk after Fuse's code ;-) but we're in AS3 land  
now so – best practice always!

Secondly, in adding sequencing I think your interface has gotten  
muddy. I get the AUTOSTART idea but don't like it, because if users  
wanted the extra convenience of a generate-then-start method like go()  
used to be, they definitely *don't* want the *in*convenience of having  
to set some special parameter first just to make that work.

Instead, just offer 4 ways to do the 4 different things:
  1) Constructor makes a tween, leave it at that, you don't need a  
secondary method that does the same thing.
  2) A method that auto-runs a tween, and reads like a verb, like go()
  3) A noun method that generates a sequence like makeSequence(),  
generateSequence(), buildSequence(), makeChain(), etc.
  4) A verb method that plays a sequence like sequence() or  
runSequence()

For example,
  new HydroTween()
  HydroTween.go():IPlayable
  HydroTween.parseChain():SequenceCA
  HydroTween.chain():SequenceCA

See what I mean? That only changes 2 things about the way you did it:  
it makes go() back into an auto-start method, and changes sequence()  
into two methods, one a "noun" and the other a "verb." More intuitive  
and would let you ditch AUTOSTART. (If you are bent on a 2-method  
interface I would just change go() to also detect and auto-start a  
sequence as well as a tween or tween group, and then have a  
makeSequence-type noun method as the second one.)

Hey, that's just my 2 cents take it or leave it – Over all this is a  
very fine release my friend! Congrats

  :-)

- Moses


On May 14, 2008, at 10:40 AM, Donovan Adams wrote:

> Thanks man!  Great Idea. I'll add that in there for the next update
-
>> Fantastic stuff!
>>
>> Suggestion based on your color reset of -1: you might add a static  
>> const for that, like HydroTween.RESET:int = -1, which would make  
>> the code easier for people to read within the action objects.
>>
>> Great job D!
>>
>> - m
>>
>> On May 13, 2008, at 10:54 PM, donovan at hydrotik.com wrote:
>>
>>> Hey folks. I made a formal post on the latest HydroTween updates  
>>> with some usage, etc. I also updated the wiki. Trying to get a  
>>> direct download on the goplayground site, in the meantime you can  
>>> get the source and example at the bottom of the blog post.
>>>
>>> http://blog.hydrotik.com/2008/05/13/go-048jg1-hydrotween-rev30-guide-source-code/
>>>
>>> Here are some snippets:
>>>
>>> // General/ColorMatrix Tweening!
>>> HydroTween.go(mc, {x:200, color:0xFF0000}, 2, 0, Elastic.easeOut,  
>>> onCompleteHandler);
>>>
>>> // Fuse style sequencing!
>>> var seq1:SequenceCA = HydroTween.sequence(
>>>     {target:fusebox, x:320, seconds:5, easing:Quadratic.easeInOut},
>>>     {target:fusebox, Blur_blurX:8, Blur_blurY:8, seconds:5,  
>>> easing:Quadratic.easeInOut},
>>>     {target:fusebox, color:0x0000FF, seconds:5,  
>>> easing:Quadratic.easeInOut},
>>>     {target:fusebox, Blur_blurX:0, Blur_blurY:0, seconds:5,  
>>> easing:Quadratic.easeInOut},
>>>     {target:fusebox, x:400, seconds:.5, easing:Quadratic.easeInOut},
>>>     {target:fusebox, rotation:270, seconds:.5,  
>>> easing:Quadratic.easeInOut}
>>> );
>>> seq1.start();
>>>
>>> Also I will be at Flashbelt. Maybe we can all Go grab a bit to eat  
>>> one night! :) sorry I couldn't help myself.
>>> _______________________________________________
>>> GoList mailing list
>>> GoList at goasap.org
>>> http://goasap.org/mailman/listinfo/golist_goasap.org
>>
>>
>> _______________________________________________
>> GoList mailing list
>> GoList at goasap.org
>> http://goasap.org/mailman/listinfo/golist_goasap.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://goasap.org/pipermail/golist_goasap.org/attachments/20080514/326699db/attachment.html 


More information about the GoList mailing list