0

I am trying for smooth zooming transitions in my stage3d (using flare3d 2.0 engine) game.

I am using GTweener to tween the camera like below

GTweener.to(_camera,0.5,{x:pos.x,y:pos.y,z:pos.z});

This is working fine, how ever I want to tween other properties which can be set only using functions, example

setRotation(x,y,z);

or

rotateX(value);

I am not sure how to call the function and pass the function parameters as parameters to the GTweerner.to function

Another work around I am aware of is passing a callback function as onUpdate property, but I prefer to avoid it to keep things simple.

Or

If some confirms me that it is not possible in GTweener then I need to look for alternative libraries which allows me to do it.

dejjub-AIS
  • 1,501
  • 2
  • 24
  • 50

2 Answers2

0

I know you're using GTWeener, but you might want to go down one level and use the GTWeen class (which GWTeener uses to simplify the process of doing tweens).

It has an onChange property that is a callback function that is called while your tween is in progress. Theoretically, you could call that setPosition() method from within the callback function to make your zoom operations smoother.

In order to do this, I assume you have to actually tween some other property, however, so this may not work or be a great idea. Pure speculation on my part, as I've never used GTween or GTweener ... I only looked at the documentation.

NOTE: you might also need to set dispatchEvents property to true to get true in order to get the callback to be executed.

Sunil D.
  • 17,983
  • 6
  • 53
  • 65
  • onChange can be used without creating the GTween instance, I wanted it to avoid it because it has overhead of handling of passing "current value". If its simple, can you please add a code snipped? – dejjub-AIS Nov 29 '12 at 12:15
0

Sometimes, objects in motion appear to be "flickering" when tweening using linear speed. By applying a different easing type, you may find it to look quite a bit smoother.

For example, using com.gskinner.motion.easing.Cubic.easeInOut:

GTweener.to(_camera,0.5,{x:pos.x,y:pos.y,z:pos.z}, {ease: Cubic.easeInOut});

I do not believe that the flickering is due to the fact that the x, y, and z properties are being set sequentially since it will all happen before a new frame is being rendered.

david.emilsson
  • 2,313
  • 1
  • 20
  • 24