Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't really get how the scaling works #22

Closed
Skeptron opened this issue Sep 24, 2016 · 5 comments
Closed

Don't really get how the scaling works #22

Skeptron opened this issue Sep 24, 2016 · 5 comments

Comments

@Skeptron
Copy link

Hi everyone!

I'm having an issue with the scaling here : I think I'm following the doc carefully but the result is not what I expected.

Here is my code :

// In the preload() method
this.game.load.spine('char', "img/char.json", ["@0.25x"]);

// In the create() method
let char = this.game.add.spine(400, 800, "char");
char.setAnimationByName(0, "idle", false);

I have 3 files :

As you might have guessed, I animated images 4 times too big in spine (just not to get blind, because original char is small), then exported the output 4 times smaller.

So I was expecting the plugin to understand that and make my char 4 times smaller ingame, but on the contrary it puts the char back to its 4-times-too-big size : it's really big and blurry (because images were shrunk 4 times, thus scaling them up by 4 makes them super blurry).
Simply put, instead of understanding that char has been reduced by 4, the plugin tries to get it back to its original size.

Is that the correct behaviour? How could I accomplish my feature (that is, animating big sprites in Spine and exporting them to a smaller, final scale?).

Thanks a lot guys!

@shibekin69
Copy link

Haven't used this type of scaling yet. But you can scale the phaser group making up the animation

@Skeptron
Copy link
Author

Yes you can. I tried setting the scale to .25, and it works, but it's blurry. Doesn't feel right : according to the doc I shouldn't have to do that :(

@AleBles
Copy link
Member

AleBles commented Sep 28, 2016

The scaling as defined in this library is assuming that only the png file is scaled so we are able to load in smaller asset files. The bones in the json still have their original sizes and will also be drawn with their original sizes.

In order to make the entire export smaller, you need to scale the rootbone before exporting (just checked with our Animator, and this works for him). If you leave the assets at the original size (no scaling) everything should look fairly crisp.

@AleBles
Copy link
Member

AleBles commented Jan 25, 2017

@Skeptron, did this awnser your question?

@Skeptron
Copy link
Author

Yeah thanks, found my way around this issue!

@AleBles AleBles closed this as completed Jan 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants