NullHypothesis
NullHypothesis

Reputation: 4516

SpriteKit Animation - Keeping Sprites Fixed

I am animating some frames of a monster jumping and swinging a sword, and the frames are such that the width gets bigger or smaller as he swings the sword (the monster standing is 500 width, but his sword, fully extended to the left, adds another 200 width, thus he varies from 500 to 700 or more in width)

I originally took each frame, which is on a transparent background, and used the Photoshop magic wand tool to select just the monster. I then saved these frames like that, and when I used them to animate, the monster warped and changed sizes (it looked bad).

The original frames had a large 1000 x 1000 transparent background surrounding him, and as a result it always kept him "bound" so that it never warped.

My question is what is a good way to create frames of animation where the sprite inside might change size or width as he's moving so that there is no warping?

If I have to use a large border of transparent pixels, is that the recommended approach? I'm noticing that for my animation, each monster takes up about 3 - 5MB. I plan on potentially having a lot of these people ultimately, so i'm wondering if this is the best approach (using large 900 x 900 images all the time, plus I'll be using more for 2x and 1x). So all of this seems like it could spiral out of control to 4 or 5GB.

What are other people doing when making animations that require different poses and positions? Just fixing the frames with borders that are as small as possible?

Thanks!

Upvotes: 2

Views: 128

Answers (1)

degapps
degapps

Reputation: 778

You should probably change the approach to animation and use inverse kinematics instead. Take a look at this and Ray's tutorial.

Upvotes: 1

Related Questions