/** Sets this matrix to a translation matrix. * @param trn The translation vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTranslation (Vector2 trn) { return setToTranslation(trn.x, trn.y); }
/** Sets this matrix to a translation matrix. * @param trn The translation vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTranslation (Vector2 trn) { return setToTranslation(trn.x, trn.y); }
afn1.setToTranslation(trn); checkEqual(mat1, afn1); afn2.setToTrnRotRadScl(trn, MathUtils.degreesToRadians * rot, scl); checkEqual(afn1, afn2); afn2.setToTranslation(trn).rotate(rot).scale(scl); checkEqual(afn1, afn2); afn1.idt().scale(scl).rotate(rot).translate(trn).shear(shear); checkEqual(mat1, afn1); afn1.idt().mul(afn2.setToScaling(scl)).mul(afn2.setToRotation(rot)).mul(afn2.setToTranslation(trn)) .mul(afn2.setToShearing(shear)); checkEqual(mat1, afn1); afn1.idt().preMul(afn2.setToShearing(shear)).preMul(afn2.setToTranslation(trn)).preMul(afn2.setToRotation(rot)) .preMul(afn2.setToScaling(scl)); checkEqual(mat1, afn1);
/** Sets this matrix to a translation matrix. * @param trn The translation vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTranslation (Vector2 trn) { return setToTranslation(trn.x, trn.y); }
/** Sets this matrix to a translation matrix. * @param trn The translation vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTranslation (Vector2 trn) { return setToTranslation(trn.x, trn.y); }
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); } }