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

请问Demo中预定义的Skeleton的位置和输出大小改如何动态调整? #1

Open
peerless2012 opened this issue Nov 16, 2022 · 3 comments

Comments

@peerless2012
Copy link

在本Demo中,Skeleton的位置和输出大小都是写死的,这些值是怎么来的呢?

@keith2018
Copy link
Owner

keith2018 commented Nov 16, 2022

demo 里是针对 spineboy 这个素材的经验值,如果希望对任意素材都大小合适且居中,可以根据 json 里的 xywidthheight 做一个计算,得到合适的 posX posYscale 参数,计算的时候可能要考虑屏幕像素比 pixelRatio

"skeleton": {
	"hash": "MOhkPvw8nLOrjuLm/U98aFMannI",
	"spine": "3.8.55",
	"x": -221.27,
	"y": -8.57,
	"width": 470.72,
	"height": 731.57,
	"images": "./images/",
	"audio": ""
}

@peerless2012
Copy link
Author

peerless2012 commented Nov 16, 2022

能给个参考吗?由于SkeletonData需要共享,所以不能在这上面设置Scale,只能在Skeleton上设置Scale和Position

@keith2018
Copy link
Owner

可以参考下官方的 player 实现
http://en.esotericsoftware.com/spine-player

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

2 participants