本文整理匯總了Java中android.view.animation.AlphaAnimation.setInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Java AlphaAnimation.setInterpolator方法的具體用法?Java AlphaAnimation.setInterpolator怎麽用?Java AlphaAnimation.setInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.AlphaAnimation
的用法示例。
在下文中一共展示了AlphaAnimation.setInterpolator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fadeIn
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* <p>對 View 做透明度變化的進場動畫。</p>
* <p>相關方法 {@link #fadeOut(View, int, Animation.AnimationListener, boolean)}</p>
*
* @param view 做動畫的 View
* @param duration 動畫時長(毫秒)
* @param listener 動畫回調
* @param isNeedAnimation 是否需要動畫
*/
public static AlphaAnimation fadeIn(View view, int duration, Animation.AnimationListener listener, boolean isNeedAnimation) {
if (view == null) {
return null;
}
if (isNeedAnimation) {
view.setVisibility(View.VISIBLE);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
alpha.setInterpolator(new DecelerateInterpolator());
alpha.setDuration(duration);
alpha.setFillAfter(true);
if (listener != null) {
alpha.setAnimationListener(listener);
}
view.startAnimation(alpha);
return alpha;
} else {
view.setAlpha(1);
view.setVisibility(View.VISIBLE);
return null;
}
}
示例2: init
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private void init(Context context, View target) {
this.context = context;
this.target = target;
fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
this.isShown = false;
if (this.target != null) {
applyTo(this.target);
} else {
show();
}
}
示例3: ToolTip
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
public ToolTip(){
/* default values */
mTitle = "";
mDescription = "";
mBackgroundColor = Color.parseColor("#3498db");
mTextColor = Color.parseColor("#FFFFFF");
mEnterAnimation = new AlphaAnimation(0f, 1f);
mEnterAnimation.setDuration(1000);
mEnterAnimation.setFillAfter(true);
mEnterAnimation.setInterpolator(new BounceInterpolator());
mShadow = true;
// TODO: exit animation
mGravity = Gravity.CENTER;
}
示例4: init
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private void init(Context context, View target, int tabIndex) {
this.context = context;
this.target = target;
this.targetTabIndex = tabIndex;
this.badgePosition = 2;
this.badgeMarginH = dipToPixels(5);
this.badgeMarginV = this.badgeMarginH;
this.badgeColor = R.color.he;
setTypeface(Typeface.DEFAULT_BOLD);
int paddingPixels = dipToPixels(5);
setPadding(paddingPixels, 0, paddingPixels, 0);
setTextColor(-1);
fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
this.isShown = false;
if (this.target != null) {
applyTo(this.target);
} else {
show();
}
}
示例5: fadeInDisplay
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
public static void fadeInDisplay(final ImageView imageView, Drawable drawable) {
AlphaAnimation fadeAnimation = new AlphaAnimation(0F, 1F);
fadeAnimation.setDuration(300);
fadeAnimation.setInterpolator(new DecelerateInterpolator());
imageView.setImageDrawable(drawable);
imageView.startAnimation(fadeAnimation);
}
示例6: animate
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* Animates {@link ImageView} with "fade-in" effect
*
* @param imageView {@link ImageView} which display image in
* @param durationMillis The length of the animation in milliseconds
*/
public static void animate(View imageView, int durationMillis) {
if (imageView != null) {
AlphaAnimation fadeImage = new AlphaAnimation(0, 1);
fadeImage.setDuration(durationMillis);
fadeImage.setInterpolator(new DecelerateInterpolator());
imageView.startAnimation(fadeImage);
}
}
示例7: startAlpha
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private AlphaAnimation startAlpha() {
AlphaAnimation alpha = new AlphaAnimation(0, 1);
alpha.setInterpolator(this, android.R.anim.accelerate_interpolator);
alpha.setStartOffset(0);
alpha.setDuration(1500);
return alpha;
}
示例8: endAlpha
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private AlphaAnimation endAlpha(int startTime) {
AlphaAnimation alpha = new AlphaAnimation(1, 0);
alpha.setInterpolator(this, android.R.anim.decelerate_interpolator);
alpha.setStartOffset(startTime - 300);
alpha.setDuration(300);
return alpha;
}
示例9: initAnimations
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private void initAnimations() {
fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(300);
slideDownTop = AnimationUtils.loadAnimation(getContext(), R.anim.slide_down_top);
slideDownTop.setInterpolator(new OvershootInterpolator(2.0f));
}
示例10: animate
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
public static void animate(View imageView, int durationMillis) {
if (imageView != null) {
AlphaAnimation fadeImage = new AlphaAnimation(0.0f, 1.0f);
fadeImage.setDuration((long) durationMillis);
fadeImage.setInterpolator(new DecelerateInterpolator());
imageView.startAnimation(fadeImage);
}
}
示例11: init
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
private void init(Context context, View target, int tabIndex)
{
this.context = context;
this.target = target;
this.targetTabIndex = tabIndex;
// apply defaults
badgePosition = DEFAULT_POSITION;
badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
badgeMarginV = badgeMarginH;
badgeColor = DEFAULT_BADGE_COLOR;
setTypeface(Typeface.DEFAULT_BOLD);
int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
setPadding(paddingPixels, 0, paddingPixels, 0);
setTextColor(DEFAULT_TEXT_COLOR);
fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator());
fadeIn.setDuration(200);
fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator());
fadeOut.setDuration(200);
isShown = false;
if (this.target != null)
{
applyTo(this.target);
}
else
{
show();
}
}
示例12: animateViews
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
void animateViews(boolean animateTime) {
if (!isLoaded) {
final AlphaAnimation fade = new AlphaAnimation(0, 1);
fade.setDuration(fadeDuration);
fade.setInterpolator(new DecelerateInterpolator());
if (titleVisible) {
titleView.startAnimation(fade);
}
if (timeVisible && animateTime) {
timeView.startAnimation(fade);
}
thumbnailView.startAnimation(fade);
}
}
示例13: makeOpenCloseAnimation
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
static Animation makeOpenCloseAnimation(Context context, float startScale, float endScale, float startAlpha, float endAlpha) {
AnimationSet set = new AnimationSet(false);
ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale, 1, 0.5f, 1, 0.5f);
scale.setInterpolator(DECELERATE_QUINT);
scale.setDuration(220);
set.addAnimation(scale);
AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
alpha.setInterpolator(DECELERATE_CUBIC);
alpha.setDuration(220);
set.addAnimation(alpha);
return set;
}
示例14: getAnimationSetFromLeft
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* 從左側進入,並帶有彈性的動畫
*
* @return
*/
public static AnimationSet getAnimationSetFromLeft() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, -1.0f, RELATIVE_TO_SELF, 0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX1.setDuration(300);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
TranslateAnimation translateX2 = new TranslateAnimation(RELATIVE_TO_SELF, 0.1f, RELATIVE_TO_SELF, -0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX2.setStartOffset(300);
translateX2.setInterpolator(new DecelerateInterpolator());
translateX2.setDuration(50);
TranslateAnimation translateX3 = new TranslateAnimation(RELATIVE_TO_SELF, -0.1f, RELATIVE_TO_SELF, 0f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX3.setStartOffset(350);
translateX3.setInterpolator(new DecelerateInterpolator());
translateX3.setDuration(50);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 1.0f);
alphaAnimation.setDuration(400);
alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.addAnimation(translateX1);
animationSet.addAnimation(translateX2);
animationSet.addAnimation(translateX3);
//animationSet.addAnimation(alphaAnimation);
animationSet.setDuration(400);
return animationSet;
}
示例15: getAnimationSetFromRight
import android.view.animation.AlphaAnimation; //導入方法依賴的package包/類
/**
* 從右側進入,並帶有彈性的動畫
*
* @return
*/
public static AnimationSet getAnimationSetFromRight() {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateX1 = new TranslateAnimation(RELATIVE_TO_SELF, 1.0f, RELATIVE_TO_SELF, -0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX1.setDuration(300);
translateX1.setInterpolator(new DecelerateInterpolator());
translateX1.setStartOffset(0);
TranslateAnimation translateX2 = new TranslateAnimation(RELATIVE_TO_SELF, -0.1f, RELATIVE_TO_SELF, 0.1f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX2.setStartOffset(300);
translateX2.setInterpolator(new DecelerateInterpolator());
translateX2.setDuration(50);
TranslateAnimation translateX3 = new TranslateAnimation(RELATIVE_TO_SELF, 0.1f, RELATIVE_TO_SELF, 0f,
RELATIVE_TO_SELF, 0, RELATIVE_TO_SELF, 0);
translateX3.setStartOffset(350);
translateX3.setInterpolator(new DecelerateInterpolator());
translateX3.setDuration(50);
AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f, 1.0f);
alphaAnimation.setDuration(400);
alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
animationSet.addAnimation(translateX1);
animationSet.addAnimation(translateX2);
animationSet.addAnimation(translateX3);
animationSet.addAnimation(alphaAnimation);
animationSet.setDuration(400);
return animationSet;
}