public class ShakeAnimation extends Animation
DIRECTION_DOWN, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DURATION_DEFAULT, DURATION_LONG, DURATION_SHORT
Constructor and Description |
---|
ShakeAnimation(View view)
This animation causes the view to shake from left to right for a
customizable number of times before returning to its original position.
|
Modifier and Type | Method and Description |
---|---|
void |
animate()
This method animates the properties of the view specific to the Animation
object.
|
long |
getDuration() |
TimeInterpolator |
getInterpolator() |
AnimationListener |
getListener() |
int |
getNumOfShakes() |
float |
getShakeDistance() |
ShakeAnimation |
setDuration(long duration) |
ShakeAnimation |
setInterpolator(TimeInterpolator interpolator) |
ShakeAnimation |
setListener(AnimationListener listener) |
ShakeAnimation |
setNumOfShakes(int numOfShakes) |
ShakeAnimation |
setShakeDistance(float shakeDistance) |
public ShakeAnimation(View view)
view
- The view to be animated.public void animate()
Animation
public float getShakeDistance()
public ShakeAnimation setShakeDistance(float shakeDistance)
shakeDistance
- The maximum shake distance to set.public int getNumOfShakes()
public ShakeAnimation setNumOfShakes(int numOfShakes)
numOfShakes
- The number of shakes to set.public TimeInterpolator getInterpolator()
public ShakeAnimation setInterpolator(TimeInterpolator interpolator)
interpolator
- The interpolator of the entire animation to set.public long getDuration()
public ShakeAnimation setDuration(long duration)
duration
- The duration of the entire animation to set.public AnimationListener getListener()
public ShakeAnimation setListener(AnimationListener listener)
listener
- The listener to set for the end of the animation.