Re: comparison of tween libraries

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Confidant
I was trying to use GTweenHX with Jeash/Flash, tweening both x  
coordinates and alpha. It worked in Flash but Jeash would only do  
alpha. I'd love to either get that working or else find a tween  
library that does work.
-Allan

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

singmajesty
I use Actuate

haxelib install actuate


Actuate.tween (MyObject, 1, { x: 100, y: 100 } ).delay (1).onComplete  
(myCallback);


On Mon, 13 Jun 2011 07:53:08 -0700, Allan Dowdeswell  
<[hidden email]> wrote:

> I was trying to use GTweenHX with Jeash/Flash, tweening both x  
> coordinates and alpha. It worked in Flash but Jeash would only do alpha.  
> I'd love to either get that working or else find a tween library that  
> does work.
> -Allan
>


--
Using Opera's revolutionary email client: http://www.opera.com/mail/

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Niel Drummond-3
In reply to this post by Confidant
On 06/13/11 16:53, Allan Dowdeswell wrote:
> I was trying to use GTweenHX with Jeash/Flash, tweening both x
> coordinates and alpha. It worked in Flash but Jeash would only do
> alpha. I'd love to either get that working or else find a tween
> library that does work.
> -Allan
>
you need to use:

    #if js
    GTween.patchTick(bugsBows);
    #end
 
Because jeash currently doesn't send ENTER_FRAME to off-stage
DisplayObjects. This will also automatically import a GTween Jeash
plugin, that makes sure the correct getter/setters are called in the
tween routine.

See for example:

http://fussybeaver.org/jeash-demos/wonderfl/bNJ1/BugsBows.hx
http://fussybeaver.org/jeash-demos/wonderfl/bNJ1/bugsbows.html

- Niel

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Niel Drummond-3
On 06/13/11 19:16, Niel Drummond wrote:

> On 06/13/11 16:53, Allan Dowdeswell wrote:
>> I was trying to use GTweenHX with Jeash/Flash, tweening both x
>> coordinates and alpha. It worked in Flash but Jeash would only do
>> alpha. I'd love to either get that working or else find a tween
>> library that does work.
>> -Allan
>>
> you need to use:
>
>     #if js
>     GTween.patchTick(bugsBows);
>     #end

Sorry that should be:

myTweenObj = new Sprite();
// draw something in the sprite
#if js
GTween.pathTick(myTweenObj);
#end
new GTween(myTweenObj, ...);

- Niel

>  
> Because jeash currently doesn't send ENTER_FRAME to off-stage
> DisplayObjects. This will also automatically import a GTween Jeash
> plugin, that makes sure the correct getter/setters are called in the
> tween routine.
>
> See for example:
>
> http://fussybeaver.org/jeash-demos/wonderfl/bNJ1/BugsBows.hx
> http://fussybeaver.org/jeash-demos/wonderfl/bNJ1/bugsbows.html
>
> - Niel
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Confidant
In reply to this post by Confidant
> Sorry that should be:
>
> myTweenObj = new Sprite();
> // draw something in the sprite
> #if js
> GTween.pathTick(myTweenObj);
> #end
> new GTween(myTweenObj, ...);
>
> - Niel

Thanks Niel; I think I did have that in place however. :(  Alpha is  
tweening, x is not:

var b:Bitmap=new Bitmap(bd);
var s:Sprite=new Sprite();
s.addChild(b);
theApp.addChild( s );

b.smoothing=true;
s.scaleX=1.65;
s.scaleY=1.65;
s.rotation=24;
s.alpha=0.6;
               
#if (js||cpp)
       
GTween.patchTick(s);
#end
               
new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Tony Polinelli
I've used actuate also, and it worked well on iphone

On Tue, Jun 14, 2011 at 12:57 PM, Allan Dowdeswell <[hidden email]> wrote:
Sorry that should be:

myTweenObj = new Sprite();
// draw something in the sprite
#if js
GTween.pathTick(myTweenObj);
#end
new GTween(myTweenObj, ...);

- Niel

Thanks Niel; I think I did have that in place however. :(  Alpha is tweening, x is not:

var b:Bitmap=new Bitmap(bd);
var s:Sprite=new Sprite();
s.addChild(b);
theApp.addChild( s );

b.smoothing=true;
s.scaleX=1.65;
s.scaleY=1.65;
s.rotation=24;
s.alpha=0.6;
               
#if (js||cpp)
       
GTween.patchTick(s);
#end
               
new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});


--
haXe - an open source web programming language
http://haxe.org



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Niel Drummond-3
In reply to this post by Confidant
On 06/14/11 04:57, Allan Dowdeswell wrote:

>> Sorry that should be:
>>
>> myTweenObj = new Sprite();
>> // draw something in the sprite
>> #if js
>> GTween.pathTick(myTweenObj);
>> #end
>> new GTween(myTweenObj, ...);
>>
>> - Niel
>
> Thanks Niel; I think I did have that in place however. :(  Alpha is
> tweening, x is not:
>
> var b:Bitmap=new Bitmap(bd);
> var s:Sprite=new Sprite();
> s.addChild(b);
> theApp.addChild( s );
>
> b.smoothing=true;
> s.scaleX=1.65;
> s.scaleY=1.65;
> s.rotation=24;
> s.alpha=0.6;

s.x = 0; // maybe an initial state is needed?

- Niel
>        
> #if (js||cpp)
>    
> GTween.patchTick(s);
> #end
>        
> new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});
>


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Andy Li
I believe Actuate as well as most of the tweening libs (except feffects) use Reflection.
And haxe/JS does not support Reflection on getter/setter, that's why it doesn't work.

To make it work, attach a onChange (or similar) handler on the tween, and set x/y inside the handler, remember to cast the tween target as DisplayObject.

Hope it helps,
Andy

On Tue, Jun 14, 2011 at 12:56 PM, Niel Drummond <[hidden email]> wrote:
On 06/14/11 04:57, Allan Dowdeswell wrote:
>> Sorry that should be:
>>
>> myTweenObj = new Sprite();
>> // draw something in the sprite
>> #if js
>> GTween.pathTick(myTweenObj);
>> #end
>> new GTween(myTweenObj, ...);
>>
>> - Niel
>
> Thanks Niel; I think I did have that in place however. :(  Alpha is
> tweening, x is not:
>
> var b:Bitmap=new Bitmap(bd);
> var s:Sprite=new Sprite();
> s.addChild(b);
> theApp.addChild( s );
>
> b.smoothing=true;
> s.scaleX=1.65;
> s.scaleY=1.65;
> s.rotation=24;
> s.alpha=0.6;

s.x = 0; // maybe an initial state is needed?

- Niel
>
> #if (js||cpp)
>
> GTween.patchTick(s);
> #end
>
> new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});
>


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Tony Polinelli
aaah - on c++ getters and setters work in reflection? i think there is something different -- hugh? 


On Tue, Jun 14, 2011 at 5:37 PM, Andy Li <[hidden email]> wrote:
I believe Actuate as well as most of the tweening libs (except feffects) use Reflection.
And haxe/JS does not support Reflection on getter/setter, that's why it doesn't work.

To make it work, attach a onChange (or similar) handler on the tween, and set x/y inside the handler, remember to cast the tween target as DisplayObject.

Hope it helps,
Andy


On Tue, Jun 14, 2011 at 12:56 PM, Niel Drummond <[hidden email]> wrote:
On 06/14/11 04:57, Allan Dowdeswell wrote:
>> Sorry that should be:
>>
>> myTweenObj = new Sprite();
>> // draw something in the sprite
>> #if js
>> GTween.pathTick(myTweenObj);
>> #end
>> new GTween(myTweenObj, ...);
>>
>> - Niel
>
> Thanks Niel; I think I did have that in place however. :(  Alpha is
> tweening, x is not:
>
> var b:Bitmap=new Bitmap(bd);
> var s:Sprite=new Sprite();
> s.addChild(b);
> theApp.addChild( s );
>
> b.smoothing=true;
> s.scaleX=1.65;
> s.scaleY=1.65;
> s.rotation=24;
> s.alpha=0.6;

s.x = 0; // maybe an initial state is needed?

- Niel
>
> #if (js||cpp)
>
> GTween.patchTick(s);
> #end
>
> new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});
>


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

George McBay
In reply to this post by Andy Li
This same issue exists in as2/Flash.  I use Brett Johnson's haxe
GTween port there but modified to use Reflect.callMethod on the
property getter/setters, using the haxe convention of 'set_property'.

eg, in GTween.hx: Reflect.setField(target,nm,val);

Becomes:  Reflect.callMethod(target, Reflect.field(target, "set_" + nm), [val]);
       

and: _initValues.set(n,Reflect.field(target,n));

Becomes: _initValues.set(n, Reflect.callMethod(target,
Reflect.field(target, "get_" + n), []));


This tends to work a lot better and works across haxe platforms when
you're using haxe properties, though it forces you to use some type of
getter/setter convention.



On Tue, Jun 14, 2011 at 12:37 AM, Andy Li <[hidden email]> wrote:

> I believe Actuate as well as most of the tweening libs (except feffects) use
> Reflection.
> And haxe/JS does not support Reflection on getter/setter, that's why it
> doesn't work.
> To make it work, attach a onChange (or similar) handler on the tween, and
> set x/y inside the handler, remember to cast the tween target as
> DisplayObject.
> Hope it helps,
> Andy
>
> On Tue, Jun 14, 2011 at 12:56 PM, Niel Drummond
> <[hidden email]> wrote:
>>
>> On 06/14/11 04:57, Allan Dowdeswell wrote:
>> >> Sorry that should be:
>> >>
>> >> myTweenObj = new Sprite();
>> >> // draw something in the sprite
>> >> #if js
>> >> GTween.pathTick(myTweenObj);
>> >> #end
>> >> new GTween(myTweenObj, ...);
>> >>
>> >> - Niel
>> >
>> > Thanks Niel; I think I did have that in place however. :(  Alpha is
>> > tweening, x is not:
>> >
>> > var b:Bitmap=new Bitmap(bd);
>> > var s:Sprite=new Sprite();
>> > s.addChild(b);
>> > theApp.addChild( s );
>> >
>> > b.smoothing=true;
>> > s.scaleX=1.65;
>> > s.scaleY=1.65;
>> > s.rotation=24;
>> > s.alpha=0.6;
>>
>> s.x = 0; // maybe an initial state is needed?
>>
>> - Niel
>> >
>> > #if (js||cpp)
>> >
>> > GTween.patchTick(s);
>> > #end
>> >
>> > new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});
>> >
>>
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Gamehaxe
In reply to this post by Tony Polinelli
Yes, cpp supports getters/setters by reflection and dynamic access.
For neko, you must first cast to DisplayObject as suggested.

> aaah - on c++ getters and setters work in reflection? i think there is
> something different -- hugh?
>
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Confidant
In reply to this post by Confidant
>
> On 06/14/11 04:57, Allan Dowdeswell wrote:
>>> Sorry that should be:
>>>
>>> myTweenObj = new Sprite();
>>> // draw something in the sprite
>>> #if js
>>> GTween.pathTick(myTweenObj);
>>> #end
>>> new GTween(myTweenObj, ...);
>>>
>>> - Niel
>>
>> Thanks Niel; I think I did have that in place however. :(  Alpha is
>> tweening, x is not:
>>
>> var b:Bitmap=new Bitmap(bd);
>> var s:Sprite=new Sprite();
>> s.addChild(b);
>> theApp.addChild( s );
>>
>> b.smoothing=true;
>> s.scaleX=1.65;
>> s.scaleY=1.65;
>> s.rotation=24;
>> s.alpha=0.6;
>
> s.x = 0; // maybe an initial state is needed?
>
> - Niel
>>
>> #if (js||cpp)
>>
>> GTween.patchTick(s);
>> #end
>>
>> new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});
>>

Thanks, initial state did not cure it. :(
-Allan

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

Joshua Harlan Lifton
Thanks for everyone's suggestions. I ended up using actuate to replace
feffects because it was the first alternative I tried and it worked
out of the box. Aside from not having the bug feffects apparently has
(doesn't play well if other code is using haxe.Timer), actuate
required a bit less code to get the same results.

Josh

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: comparison of tween libraries

brett
In reply to this post by Confidant
Hi Allen-

I'm trying to track down and fix the bug you are noting in GTweenHX + Jeash. I haven't been able to reproduce the issue yet.

browsers: Firefox 4, Chrome 13, Safari 5
libs: latest haxelib (jeash 0.8.5, GTweenHX 0.2.2)

test code:

/******** App.hx ********/
package;
        import flash.display.Sprite;
        import flash.display.BitmapData;
        import flash.display.Bitmap;
        import com.gskinner.motion.GTween;
        import com.gskinner.motion.easing.Sine;
       
        #if (flash || js)
          import flash.Lib;
        #elseif cpp
          import nme.Lib;
        #end

class App extends Sprite{
       
        public static function main() {
            #if (flash || js)
                Lib.current.stage.addChild(new App());
            #elseif cpp
              Lib.create(function(){new App();},640,480,60,0xffffff,(1*Lib.HARDWARE)|Lib.RESIZABLE);
            #end
        }
       
        public function new(){
                super();
                               
                var theApp = this;
                var bd = new BitmapData(30,30,false,0xFF0000);
               
                var b:Bitmap=new Bitmap(bd);
                var s:Sprite=new Sprite();
                s.addChild(b);
                theApp.addChild( s );

                b.smoothing=true;
                s.scaleX=1.65;
                s.scaleY=1.65;
                s.rotation=24;
                s.alpha=0.6;
               
                #if (js||cpp)
                    GTween.patchTick(s);
                #end        
               
                new GTween(s, 1, {x:250, alpha:1,rotation:0}, {ease:Sine.easeInOut});
        }
}

/****** app.hxml ********/
# js
-js app.js
-main App
-cp src
-lib GTweenHX
-lib jeash
--remap flash:jeash

/******* app.html ********/
<html>
    <head>
        <title>GTweenHX test</title>
    </head>
    <body>
        <div id="haxe:jeash" style="width:640px; height: 480px" data-framerate="30" data-priority="2d"></div>
        <script type="text/javascript" src="app.js"></script>    </body>
</html>



//---------


Just for clarification, although GTweenHX uses the Reflection API, it avoids
the getter/setter issue for DisplayObjects in Jeash by using a plugin that is
activated when patchTick is called.
//-------------

If anyone is able to reproduce this, please let me know, either on this thread
or at http://code.google.com/p/gtweenhx/issues/list

- Brett