FileDocCategorySizeDatePackage
Transformation.javaAPI DocAndroid 1.5 API4158Wed May 06 22:41:56 BST 2009android.view.animation

Transformation

public class Transformation extends Object
Defines the transformation to be applied at one point in time of an Animation.

Fields Summary
public static int
TYPE_IDENTITY
Indicates a transformation that has no effect (alpha = 1 and identity matrix.)
public static int
TYPE_ALPHA
Indicates a transformation that applies an alpha only (uses an identity matrix.)
public static int
TYPE_MATRIX
Indicates a transformation that applies a matrix only (alpha = 1.)
public static int
TYPE_BOTH
Indicates a transformation that applies an alpha and a matrix.
protected android.graphics.Matrix
mMatrix
protected float
mAlpha
protected int
mTransformationType
Constructors Summary
public Transformation()
Creates a new transformation with alpha = 1 and the identity matrix.


                     
      
        clear();
    
Methods Summary
public voidclear()
Reset the transformation to a state that leaves the object being animated in an unmodified state. The transformation type is {@link #TYPE_BOTH} by default.

        if (mMatrix == null) {
            mMatrix = new Matrix();
        } else {
            mMatrix.reset();
        }
        mAlpha = 1.0f;
        mTransformationType = TYPE_BOTH;
    
public voidcompose(android.view.animation.Transformation t)
Apply this Transformation to an existing Transformation, e.g. apply a scale effect to something that has already been rotated.

param
t

        mAlpha *= t.getAlpha();
        mMatrix.preConcat(t.getMatrix());
    
public floatgetAlpha()

return
The degree of transparency

        return mAlpha;
    
public android.graphics.MatrixgetMatrix()

return
The 3x3 Matrix representing the trnasformation to apply to the coordinates of the object being animated

        return mMatrix;
    
public intgetTransformationType()
Indicates the nature of this transformation.

return
{@link #TYPE_ALPHA}, {@link #TYPE_MATRIX}, {@link #TYPE_BOTH} or {@link #TYPE_IDENTITY}.

        return mTransformationType;
    
public voidset(android.view.animation.Transformation t)
Clones the specified transformation.

param
t The transformation to clone.

        mAlpha = t.getAlpha();
        mMatrix.set(t.getMatrix());
        mTransformationType = t.getTransformationType();
    
public voidsetAlpha(float alpha)
Sets the degree of transparency

param
alpha 1.0 means fully opaqe and 0.0 means fully transparent

        mAlpha = alpha;
    
public voidsetTransformationType(int transformationType)
Sets the transformation type.

param
transformationType One of {@link #TYPE_ALPHA}, {@link #TYPE_MATRIX}, {@link #TYPE_BOTH} or {@link #TYPE_IDENTITY}.

        mTransformationType = transformationType;
    
public java.lang.StringtoShortString()
Return a string representation of the transformation in a compact form.

        return "{alpha=" + mAlpha + " matrix=" + mMatrix.toShortString() + "}";
    
public java.lang.StringtoString()

        return "Transformation{alpha=" + mAlpha + " matrix="
                + mMatrix.toShortString() + "}";