是否可以在 libgdx
中倾斜/剪切演员(图像)?
Is it possible to skew/shear actor (image) in libgdx
?
我发现精灵可能会出现倾斜,如 在此处讨论
I have found that skew is possible for sprites, as discussed here
演员呢?
这对我有用:
class SkewActor extends Actor {
private TextureRegion tex;
private Affine2 affine = new Affine2();
public SkewActor(TextureRegion textureRegion) {
this.tex = textureRegion;
}
@Override
public void draw(Batch batch, float parentAlpha) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
affine.setToTranslation(getX(), getY());
affine.shear(0.5f, 0); // <- modify skew here
batch.draw(tex,getWidth(), getHeight(), affine);
}
}
这篇关于是否可以在 libgdx 中扭曲演员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!