本文整理汇总了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;
}