Jump to content

3D Rotation of Sprites (card flip animation)


Julio Rodrigues
 Share

Recommended Posts

Fake flip:

-reduce the x scale of the image until it reaches 0

-change sprite

-increase x scale until it reaches 1 (or default full size value)

 

note: image x origin should probably be the center of the image

 

That is what I did for my Memory Flip game and it doesn't look that bad. i use GM: Studio but I'm sure there is an equivalent on what you are using.

Link to comment
Share on other sites

@xerver, you mean by projecting using a perspective projection matrix? How can I skew a sprite in Pixi? 

 

@-AAG-, that's a nice effect indeed, I've saw some games in flash using this animation. Thanks!

 

Yes, and there isn't a way to have it done for you; you would have to create a custom renderable object.

Link to comment
Share on other sites

  • 1 year later...
animate();

var sprite_animation = true;

function animate() {

 

    requestAnimationFrame(animate);

 

    if(sprite_animation){

 

        sprite.scale.x -= 0.01;

        sprite.position.x +=0.5;

        if(sprite2.scale.x < 0 ){

          sprite_animation = false; 

        }

    }else{

 

        sprite.scale.x += 0.01;

        sprite.position.x -=0.5;

        if(sprite.scale.x == 1 ){

          sprite_animation = true;

          

        }

    }

}

Link to comment
Share on other sites

  • 1 year later...
On 9/3/2015 at 3:02 PM, khinjer said:
animate();

 

var sprite_animation = true;

 

 

function animate() {

 

 

 

 

 

    requestAnimationFrame(animate);

 

 

 

 

 

    if(sprite_animation){

 

 

 

 

 

        sprite.scale.x -= 0.01;

 

 

        sprite.position.x +=0.5;

 

 

        if(sprite2.scale.x < 0 ){

 

 

          sprite_animation = false; 

 

 

        }

 

 

    }else{

 

 

 

 

 

        sprite.scale.x += 0.01;

 

 

        sprite.position.x -=0.5;

 

 

        if(sprite.scale.x == 1 ){

 

 

          sprite_animation = true;

 

 

          

 

 

        }

 

 

    }

 

 

}

 

is sprite2 a child of sprite?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...