Quick Links: Gideros Home | Download Gideros | Developer Guide
GTween an sprite using different easings
  • FavflyFavfly +1 -1
    Member
    I’ve created a MovieClip sprite that repeats an animation over and over. I want to move that sprite from one place on screen to another. I’ve achieved that with the following gtween.
    GTween.new(animatingMovClip, 2, {x = xPos, y = yPos}, {ease = easing.inQuadratic})

    However, I want to alter the sprite’s alpha over the course of that move, but not using easing.inQuadratic - I’d like it to use a different easing. How do I do that?
  • totebototebo +1 -1 (+1 / -0 )
    Member Accepted Answer
    You have to create a new GTween to do that.

    Likes: Favfly

    My Gideros games: www.totebo.com
  • FavflyFavfly +1 -1 (+2 / -0 )
    Member
    Lol! That was easy. :-D

    I'm new to GTween. I've been using MovieClip, which is great... but now seems a lot slower the GTween.

    Thanks.

    Likes: totebo, antix

  • antixantix +1 -1 (+2 / -0 )
    Member
    @FavFly just be aware that GTween will really suck CPU resources when you use a lot of them. It really needs a rewrite to not be an EventDispatcher to make it perform better. Use it sparingly and you will be fine :)

    Likes: Favfly, totebo

    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor
  • FavflyFavfly +1 -1
    Member
    antix said:

    "...GTween will really suck CPU resources when you use a lot of them."


    Out of interest, how many is too many? ...Or is it just a case of 'you'll know when it's too many'? :-D
  • totebototebo +1 -1 (+1 / -0 )
    Member
    Do a test and see what works for you. I find MovieClip to be (much) faster, but it may depend on how you use them. Maybe the creation is the bottleneck and you need to pool GTweens or MovieClips.

    Likes: antix

    My Gideros games: www.totebo.com
  • antixantix +1 -1
    Member
    Yes the bottleneck is usually the creation and yes, a pool of them would be more efficient and then in the worst case scenario create new ones if the pool is depleted.

    It could possibly be rewritten to use a single EnterFrame event to process a table of all currently running tweens too.
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID

In this Discussion

Top Posters