本文整理匯總了Java中android.view.animation.Animation.setStartOffset方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.setStartOffset方法的具體用法?Java Animation.setStartOffset怎麽用?Java Animation.setStartOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Animation
的用法示例。
在下文中一共展示了Animation.setStartOffset方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateLineLTRAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private Animation generateLineLTRAnimation(final RectF rectF, long offset) {
final float currentLeft = rectF.left;
final float currentRight = rectF.right;
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (getCurrentState() == HBButtonState.NORMAL) {
rectF.set(rectF.left, rectF.top, currentRight - (currentRight - currentLeft) / 2 * interpolatedTime, rectF.bottom);
} else {
rectF.set(rectF.left, rectF.top, currentRight + (currentRight - currentLeft) * interpolatedTime, rectF.bottom);
}
invalidate();
}
};
animation.setDuration(getAnimationDuration());
animation.setStartOffset(offset);
return animation;
}
示例2: generateLineRTLAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {
final float currentLeft = rectF.left;
final float currentRight = rectF.right;
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (getCurrentState() == HBButtonState.NORMAL) {
rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
} else {
rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
}
invalidate();
}
};
animation.setDuration(getAnimationDuration());
animation.setStartOffset(offset);
return animation;
}
示例3: createShrinkAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例4: initAnimations
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Initializes all animations needed to show / hide views.
*/
private void initAnimations() {
Context context = getContext();
rerouteSlideDownTop = AnimationUtils.loadAnimation(context, R.anim.slide_down_top);
rerouteSlideUpTop = AnimationUtils.loadAnimation(context, R.anim.slide_up_top);
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(300);
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1000);
fadeInSlowOut = new AnimationSet(false);
fadeInSlowOut.addAnimation(fadeIn);
fadeInSlowOut.addAnimation(fadeOut);
}
示例5: onClick
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
if (disabledClick)
return;
super.onClick(v);
Animation fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setAnimationListener(this);
fadeOut.setDuration(500);
fadeOut.setStartOffset(0);
Animation fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setAnimationListener(this);
fadeIn.setDuration(500);
fadeIn.setStartOffset(250);
if (this.config == true) {
this.leftKeyPressState.startAnimation(fadeOut);
this.rightKeyPressState.startAnimation(fadeOut);
this.reedState.startAnimation(fadeOut);
} else {
this.leftKeyPressState.startAnimation(fadeIn);
this.rightKeyPressState.startAnimation(fadeIn);
this.reedState.startAnimation(fadeIn);
}
}
示例6: createAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Create an animation object to be used to animate the view, based on the animation config
* supplied at initialization time and the new view position and size.
*
* @param view the view to create the animation for
* @param x the new X position for the view
* @param y the new Y position for the view
* @param width the new width value for the view
* @param height the new height value for the view
*/
public final @Nullable Animation createAnimation(
View view,
int x,
int y,
int width,
int height) {
if (!isValid()) {
return null;
}
Animation animation = createAnimationImpl(view, x, y, width, height);
if (animation != null) {
int slowdownFactor = SLOWDOWN_ANIMATION_MODE ? 10 : 1;
animation.setDuration(mDurationMs * slowdownFactor);
animation.setStartOffset(mDelayMs * slowdownFactor);
animation.setInterpolator(mInterpolator);
}
return animation;
}
示例7: createShrinkAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例8: createShrinkAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例9: bindHolder
import android.view.animation.Animation; //導入方法依賴的package包/類
public void bindHolder(String result, int position) {
mTextView.setText(result);
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_item);
animation.setStartOffset(position * 200);
animation.setInterpolator(new AccelerateInterpolator());
itemView.startAnimation(animation);
}
示例10: onClick
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
if (disabledClick)
return;
this.config = !this.config;
Log.d("onClick", "Row ID" + v.getId());
//Toast.makeText(this.context, "Found row with title : " + this.title.getText(), Toast.LENGTH_SHORT).show();
Animation fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setAnimationListener(this);
fadeOut.setDuration(500);
fadeOut.setStartOffset(0);
Animation fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setAnimationListener(this);
fadeIn.setDuration(500);
fadeIn.setStartOffset(250);
if (this.config == true) {
this.sl1.startAnimation(fadeOut);
if ((this.sl2.isEnabled())) this.sl2.startAnimation(fadeOut);
if ((this.sl3.isEnabled())) this.sl3.startAnimation(fadeOut);
this.value.startAnimation(fadeOut);
this.onOffLegend.startAnimation(fadeIn);
this.onOff.startAnimation(fadeIn);
this.periodLegend.startAnimation(fadeIn);
this.periodBar.startAnimation(fadeIn);
} else {
this.sl1.startAnimation(fadeIn);
if ((this.sl2.isEnabled())) this.sl2.startAnimation(fadeIn);
if ((this.sl3.isEnabled())) this.sl3.startAnimation(fadeIn);
this.value.startAnimation(fadeIn);
this.onOffLegend.startAnimation(fadeOut);
this.onOff.startAnimation(fadeOut);
this.periodLegend.startAnimation(fadeOut);
this.periodBar.startAnimation(fadeOut);
}
}
示例11: createHintSwitchAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createHintSwitchAnimation(final boolean expanded) {
Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setStartOffset(0);
animation.setDuration(100);
animation.setInterpolator(new DecelerateInterpolator());
animation.setFillAfter(true);
return animation;
}
示例12: createExpandAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* 展開動畫
*/
private static Animation createExpandAnimation(float fromXDelta,
float toXDelta, float fromYDelta, float toYDelta, long startOffset,
long duration, Interpolator interpolator) {
Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0,
toYDelta, 0, 720);
animation.setStartOffset(startOffset);
animation.setDuration(duration);
animation.setInterpolator(interpolator);
animation.setFillAfter(true);
return animation;
}
示例13: startTickAnim
import android.view.animation.Animation; //導入方法依賴的package包/類
public void startTickAnim () {
// hide tick
mLeftRectWidth = 0;
mRightRectWidth = 0;
invalidate();
Animation tickAnim = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (0.54 < interpolatedTime && 0.7 >= interpolatedTime) { // grow left and right rect to right
mLeftRectGrowMode = true;
mLeftRectWidth = mMaxLeftRectWidth * ((interpolatedTime - 0.54f) / 0.16f);
if (0.65 < interpolatedTime) {
mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
}
invalidate();
} else if (0.7 < interpolatedTime && 0.84 >= interpolatedTime) { // shorten left rect from right, still grow right rect
mLeftRectGrowMode = false;
mLeftRectWidth = mMaxLeftRectWidth * (1 - ((interpolatedTime - 0.7f) / 0.14f));
mLeftRectWidth = mLeftRectWidth < MIN_LEFT_RECT_W ? MIN_LEFT_RECT_W : mLeftRectWidth;
mRightRectWidth = MAX_RIGHT_RECT_W * ((interpolatedTime - 0.65f) / 0.19f);
invalidate();
} else if (0.84 < interpolatedTime && 1 >= interpolatedTime) { // restore left rect width, shorten right rect to const
mLeftRectGrowMode = false;
mLeftRectWidth = MIN_LEFT_RECT_W + (CONST_LEFT_RECT_W - MIN_LEFT_RECT_W) * ((interpolatedTime - 0.84f) / 0.16f);
mRightRectWidth = CONST_RIGHT_RECT_W + (MAX_RIGHT_RECT_W - CONST_RIGHT_RECT_W) * (1 - ((interpolatedTime - 0.84f) / 0.16f));
invalidate();
}
}
};
tickAnim.setDuration(750);
tickAnim.setStartOffset(100);
startAnimation(tickAnim);
}
示例14: createHintSwitchAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createHintSwitchAnimation(final boolean expanded) {
Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setStartOffset(0);
animation.setDuration(100);
animation.setInterpolator(new DecelerateInterpolator());
animation.setFillAfter(true);
return animation;
}
示例15: createExpandAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
animation.setStartOffset(startOffset);
animation.setDuration(duration);
animation.setInterpolator(interpolator);
animation.setFillAfter(true);
return animation;
}