blaiprat / jquery.animateSprite

Animating sprites using jQuery made easy
http://blaiprat.github.io/jquery.animateSprite/
MIT License
122 stars 39 forks source link

How's about scale sprite #8

Closed purepure closed 10 years ago

purepure commented 10 years ago

I see that note: "Create an HTML Block Element (DIV) and define its width and height exactly as the with and height of the sprite."

But sometime in the game I want to make a boss enemy with bigger size without making new sprite for this(actually, the boss is the enemy with bigger size x2 | x3). How can we do that with your lib ?

How about scale sprite to fit div ?

It will be coool for gaming programing

Thank

tobzilla commented 10 years ago

Scaling works. Use transform: scale(2) for example, but make sure to set background-size to the original px measurements of the spritesheet. Keep an eye on width and height of the div and you should be fine. HTH, tobu Am 05.11.2014 10:25 schrieb purepure notifications@github.com:I see that note: Create an HTML Block Element (DIV) and define its width and height exactly as the with and height of the sprite.

But sometime in the game I want to make a boss enemy with bigger size without making new sprite for this(actually, the boss is the enemy with bigger size x2 | x3). How can we do that with your lib ?

How about scale sprite to fit div ?

It will be coool for gaming programing

Thank

—Reply to this email directly or view it on GitHub.

blaiprat commented 10 years ago

Hi purepure.

The plugin is using the div size to extrapolate the sprite frame width and height on the background. Having a way of overriding those values sounds interesting, but I wonder if you could try CSS transform scale approach first, which you can start using right now. So, to make it double, you'll be using something like:

.enemy {
-webkit-transform:scale(2);
   -moz-transform:scale(2);
    -ms-transform:scale(2);
     -o-transform:scale(2);
        transform:scale(2);
}

CSS transformations work on all major browsers, but they are not supported on IE8.

Let me know if this helps and adapts to your needs.

purepure commented 10 years ago

oh, I forget about transform of css. It is really simple solution for now, and ofcourse it work for me. Thank you so much About IE 8, I think it is ok, because I am trying to use your lib in a game on android and ios

Thank

blaiprat commented 10 years ago

Happy to hear that.