本文整理匯總了Java中android.view.animation.Animation.setInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.setInterpolator方法的具體用法?Java Animation.setInterpolator怎麽用?Java Animation.setInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Animation
的用法示例。
在下文中一共展示了Animation.setInterpolator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hidePlusBar
import android.view.animation.Animation; //導入方法依賴的package包/類
protected void hidePlusBar() {
mLayoutFullScreenMask.setEnabled(false);
mLayoutMessagePlusBar.setEnabled(false);
mLayoutMessagePlusPicture.setEnabled(false);
mLayoutMessagePlusCamera.setEnabled(false);
mLayoutMessagePlusLocation.setEnabled(false);
mLayoutMessagePlusGift.setEnabled(false);
mLayoutFullScreenMask.setVisibility(View.GONE);
Animation animation = AnimationUtils.loadAnimation(
BaseMessageActivity.this, R.anim.controller_exit);
animation.setInterpolator(AnimationUtils.loadInterpolator(
BaseMessageActivity.this,
android.R.anim.anticipate_interpolator));
mLayoutMessagePlusBar.setAnimation(animation);
mLayoutMessagePlusBar.setVisibility(View.GONE);
}
示例2: 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;
}
示例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: a
import android.view.animation.Animation; //導入方法依賴的package包/類
private View a(Context context) {
View linearLayout = new LinearLayout(context);
LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
layoutParams.gravity = 17;
linearLayout.setOrientation(0);
linearLayout.setLayoutParams(layoutParams);
Drawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(-450944201);
gradientDrawable.setCornerRadius((float) a(context, 5.0f));
linearLayout.setBackgroundDrawable(gradientDrawable);
View imageView = new ImageView(context);
layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
layoutParams.gravity = 16;
layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
imageView.setLayoutParams(layoutParams);
imageView.setScaleType(ScaleType.FIT_CENTER);
imageView.setImageDrawable(a(context, a.d));
Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
rotateAnimation.setRepeatCount(-1);
rotateAnimation.setDuration(900);
rotateAnimation.setInterpolator(new LinearInterpolator());
imageView.startAnimation(rotateAnimation);
View textView = new TextView(context);
textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
textView.setTextSize(16.0f);
textView.setTextColor(-1);
layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.gravity = 16;
layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
textView.setLayoutParams(layoutParams);
linearLayout.addView(imageView);
linearLayout.addView(textView);
return linearLayout;
}
示例5: snapBack
import android.view.animation.Animation; //導入方法依賴的package包/類
private void snapBack() {
if (mMainWindows.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
final RelativeLayout.LayoutParams marginLayoutParams = (RelativeLayout.LayoutParams) mMainWindows.getLayoutParams();
final int startValueX = marginLayoutParams.leftMargin;
final int startValueY = marginLayoutParams.topMargin;
final int endValueX = 0;
final int endValueY = 0;
mMainWindows.clearAnimation();
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
int leftMarginInterpolatedValue = (int) (startValueX + (endValueX - startValueX) * interpolatedTime);
marginLayoutParams.leftMargin = leftMarginInterpolatedValue;
int topMarginInterpolatedValue = (int) (startValueY + (endValueY - startValueY) * interpolatedTime);
marginLayoutParams.topMargin = topMarginInterpolatedValue;
mMainWindows.requestLayout();
}
};
animation.setDuration(400);
animation.setInterpolator(new DecelerateInterpolator());
mMainWindows.startAnimation(animation);
}
}
示例6: inFromRightAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private Animation inFromRightAnimation() {
Animation inFromRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(600);
inFromRight.setInterpolator(new AccelerateInterpolator());
return inFromRight;
}
示例7: showAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public Animation showAnimation() {
Animation animation = new AlphaAnimation(0.0f,1.0f);
animation.setDuration(200);
animation.setInterpolator(new DecelerateInterpolator());
return animation;
}
示例8: 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;
}
示例9: setupAnimations
import android.view.animation.Animation; //導入方法依賴的package包/類
private void setupAnimations() {
mAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setRotate(interpolatedTime);
}
};
mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setRepeatMode(Animation.RESTART);
mAnimation.setInterpolator(LINEAR_INTERPOLATOR);
mAnimation.setDuration(ANIMATION_DURATION);
}
示例10: fadeIn
import android.view.animation.Animation; //導入方法依賴的package包/類
static void fadeIn(View view, int duration) {
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.setDuration(duration);
view.setAnimation(anim);
view.setVisibility(View.VISIBLE);
}
示例11: animateToTab
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animateToTab(int newPosition) {
clearAnimation();
if (newPosition == Tab.INVALID_POSITION) {
return;
}
if (getWindowToken() == null || !ViewCompat.isLaidOut(this)) {
// If we don't have a window token, or we haven't been laid out yet just draw the new
// position now
setScrollPosition(newPosition, 0f);
return;
}
final int startScrollX = getScrollX();
final int targetScrollX = calculateScrollXForTab(newPosition, 0);
final int duration = ANIMATION_DURATION;
if (startScrollX != targetScrollX) {
final Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
final float value = lerp(startScrollX, targetScrollX, interpolatedTime);
scrollTo((int) value, 0);
}
};
animation.setInterpolator(INTERPOLATOR);
animation.setDuration(duration);
startAnimation(animation);
}
// Now animate the indicator
mTabStrip.animateIndicatorToPosition(newPosition, duration);
}
示例12: showActionBar
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Display the ActionBar using an animation if we are in full-screen
* mode. This method also re-parents the ActionBar if its parent is
* incorrect so that the animation can happen correctly.
*/
@Override
public void showActionBar() {
if (mFullScreen) {
Log.d(TAG, "showActionBar");
if (mToolbarLayout == null)
return;
int height = mToolbarLayout.getHeight();
if (height == 0) {
mToolbarLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
height = mToolbarLayout.getMeasuredHeight();
}
final int totalHeight = height;
if (mToolbarLayout.getTranslationY() < -(height - 0.01f)) {
Animation show = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float trans = interpolatedTime * totalHeight;
mToolbarLayout.setTranslationY(trans - totalHeight);
setWebViewTranslation(trans);
}
};
show.setDuration(250);
show.setInterpolator(new BezierDecelerateInterpolator());
mBrowserFrame.startAnimation(show);
}
}
}
示例13: startRotation
import android.view.animation.Animation; //導入方法依賴的package包/類
public static Animation startRotation(Context mContext, View view) {
Animation circle_anim=null;
if (circle_anim == null) {
circle_anim = AnimationUtils.loadAnimation(mContext, R.anim.anim_round_rotate);
}
LinearInterpolator interpolator = new LinearInterpolator();
circle_anim.setInterpolator(interpolator);
if (circle_anim != null) {
view.startAnimation(circle_anim);
}
return circle_anim;
}
示例14: shakeAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* 晃動動畫
* @param counts 0.5秒鍾晃動多少下
* @return
*/
private Animation shakeAnimation(int counts){
Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
translateAnimation.setInterpolator(new CycleInterpolator(counts));
translateAnimation.setDuration(500);
return translateAnimation;
}
示例15: getAlphaAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation getAlphaAnimation(float from, float to, int duration) {
final Animation anim = new AlphaAnimation(from, to);
anim.setInterpolator(new FastOutSlowInInterpolator());
anim.setDuration(duration);
return anim;
}