本文整理汇总了Java中android.animation.AnimatorSet.setDuration方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet.setDuration方法的具体用法?Java AnimatorSet.setDuration怎么用?Java AnimatorSet.setDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.setDuration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public void startAnimation(final DynamicWeatherView dynamicWeatherView, int fromColor) {
super.startAnimation(dynamicWeatherView, fromColor);
ValueAnimator animator1 = ValueAnimator.ofFloat(0, 1);
animator1.setInterpolator(new OvershootInterpolator());
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
speed = (float) animation.getAnimatedValue() * 32;
rotate = (float) animation.getAnimatedValue();
}
});
AnimatorSet animSet = new AnimatorSet();
animSet.play(animator1);
animSet.setDuration(1000);
animSet.start();
}
示例2: setHighlighted
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void setHighlighted(boolean value) {
AnimatorSet animatorSet = new AnimatorSet();
if (value) {
animatorSet.playTogether(
ObjectAnimator.ofFloat(this, "scaleX", 1.06f),
ObjectAnimator.ofFloat(this, "scaleY", 1.06f));
} else {
animatorSet.playTogether(
ObjectAnimator.ofFloat(this, "scaleX", 1.0f),
ObjectAnimator.ofFloat(this, "scaleY", 1.0f));
animatorSet.setStartDelay(40);
}
animatorSet.setDuration(120);
animatorSet.setInterpolator(interpolator);
animatorSet.start();
}
示例3: targetViewAnim
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 用于小圆点的放大缩小
* @param view
* @param type
*/
private void targetViewAnim(final View view, final int type){
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator scaleX = null;
ObjectAnimator scaleY = null;
ObjectAnimator alpha = null;
if (type == ANIM_OUT){
scaleX = ObjectAnimator.ofFloat(view,"scaleX",SCALE_MIN,mScale_max);
scaleY = ObjectAnimator.ofFloat(view,"scaleY",SCALE_MIN,mScale_max);
alpha = ObjectAnimator.ofFloat(view,"alpha",mAlpha_min,ALPHA_MAX);
animatorSet.setDuration(ANIM_OUT_TIME);
}else{
scaleX = ObjectAnimator.ofFloat(view,"scaleX",mScale_max,SCALE_MIN);
scaleY = ObjectAnimator.ofFloat(view,"scaleY",mScale_max,SCALE_MIN);
alpha = ObjectAnimator.ofFloat(view,"alpha",ALPHA_MAX,mAlpha_min);
animatorSet.setDuration(ANIM_IN_TIME);
}
animatorSet.play(scaleX).with(scaleY).with(alpha);
animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
animatorSet.start();
}
示例4: runSwipeAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void runSwipeAnimation(long time) {
cancelRunningAnimation();
mSwipedAway = getTranslationX();
ObjectAnimator swipe = ObjectAnimator.ofFloat(this, View.TRANSLATION_X,
getTranslationX() > 0 ? getWidth() : -getWidth());
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(this, View.ALPHA, 0.f);
AnimatorSet set = new AnimatorSet();
set.playTogether(fadeOut, swipe);
set.addListener(mCloseAnimatorListener);
set.setDuration(Math.min(time, mDefaultAnimationDurationMs));
set.start();
mActiveAnimation = set;
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:AccessibilityTabModelListItem.java
示例5: startAnimation
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void startAnimation() {
Point startPoint = new Point(RADIUS, RADIUS);
Point endPoint = new Point(getWidth() - RADIUS, getHeight() - RADIUS);
ValueAnimator anim = ValueAnimator.ofObject(new PointEvaluator(), startPoint, endPoint);
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
currentPoint = (Point) animation.getAnimatedValue();
invalidate();
}
});
ObjectAnimator anim2 = ObjectAnimator.ofObject(this, "color", new ColorEvaluator(),
"#0000FF", "#FF0000");
AnimatorSet animSet = new AnimatorSet();
animSet.play(anim).with(anim2);
animSet.setDuration(5000);
animSet.start();
}
示例6: smoothScrollTo
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void smoothScrollTo(int desX, int desY, AnimatorListener listener)
{
ObjectAnimator xTranslate = ObjectAnimator.ofInt(this, "scrollX", desX);
ObjectAnimator yTranslate = ObjectAnimator.ofInt(this, "scrollY", desY);
yTranslate.addUpdateListener(new AnimatorUpdateListener()
{
@Override
public void onAnimationUpdate(ValueAnimator animation)
{
if (mHeaderStatusChangedListener != null) mHeaderStatusChangedListener.onHeaderOffsetChanged((int) (mScrollOffsetHeight * animation.getAnimatedFraction()), animation.getAnimatedFraction());
}
});
AnimatorSet animators = new AnimatorSet();
animators.setDuration(240L);
animators.playTogether(xTranslate, yTranslate);
if (listener != null) animators.addListener(listener);
animators.start();
}
示例7: dismiss
import android.animation.AnimatorSet; //导入方法依赖的package包/类
void dismiss() {
// Disable action button during animation.
mActionButtonView.setEnabled(false);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(mAnimationDuration);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mParent.removeOnLayoutChangeListener(mLayoutListener);
mParent.removeView(mView);
}
});
Animator moveDown = ObjectAnimator.ofFloat(mView, View.TRANSLATION_Y,
mView.getHeight() + getLayoutParams().bottomMargin);
moveDown.setInterpolator(new DecelerateInterpolator());
Animator fadeOut = ObjectAnimator.ofFloat(mView, View.ALPHA, 0f);
fadeOut.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);
animatorSet.playTogether(fadeOut, moveDown);
startAnimatorOnSurfaceView(animatorSet);
}
示例8: NoticePopup
import android.animation.AnimatorSet; //导入方法依赖的package包/类
public NoticePopup(Context context, int width, int height) {
super(context, width, height);
setBackgroundColor(0x99000000);
Menu = notice.getFMview(getContext(),false);
back = new radiusSqure(Menu.width,Menu.height,0,0, Ui.cd.getHt(13));
back.setColor(backgroundImg.Color0);
Menu.InCenter(width,height);
Menu.setBackgroundColor(0x00000000);
addView(Menu);
setAlpha(0);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Ui.bk.back();
}
});
Set = new AnimatorSet();
Set.setInterpolator(Ui.cd.TH);
Set.setDuration(200);
Set.playTogether(
ObjectAnimator.ofFloat(this, "Alpha", 1.0F)
);
Set.start();
}
示例9: start
import android.animation.AnimatorSet; //导入方法依赖的package包/类
public void start(View view) {
if (lastAnimator != null) {
lastAnimator.removeAllListeners();
lastAnimator.end();
lastAnimator.cancel();
}
ObjectAnimator animX = ObjectAnimator.ofFloat(view, "scaleX", 1.6f, 1.0f);
ObjectAnimator animY = ObjectAnimator.ofFloat(view, "scaleY", 1.6f, 1.0f);
AnimatorSet animSet = new AnimatorSet();
lastAnimator = animSet;
animSet.setDuration(400);
animSet.setInterpolator(new OvershootInterpolator());
animSet.playTogether(animX, animY);
animSet.start();
}
示例10: initAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 初始化动画操作
*/
private void initAnimator( ViewHolder holder){
ObjectAnimator mItem = ObjectAnimator.ofFloat(holder.itemView, "translationX",0f, -60f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(holder.mImage, "scaleX",1f, 0f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(holder.mImage, "scaleY",1f, 0f);
AnimatorSet animSet = new AnimatorSet();
animSet.play(mItem).with(scaleX).with(scaleY);
animSet.setDuration(0);
animSet.start();
}
示例11: doHeartBeat
import android.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 心跳动画
* @param view 视图
* @param duration 时间
*/
public static void doHeartBeat(View view, int duration) {
AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 1.4f, 0.9f, 1.0f),
ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 1.4f, 0.9f, 1.0f)
);
set.setDuration(duration);
set.start();
}
示例12: dismissViewUp
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void dismissViewUp(final View view){
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationY", 0f, -100f);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view,"alpha",1f,0f);
AnimatorSet set = new AnimatorSet();
set.setDuration(500);
set.playTogether(animator1, animator2);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
}
});
set.start();
}
示例13: createAnimator
import android.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
if (startValues == null || endValues == null || changeBounds == null) {
return null;
}
Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);
if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
return null;
}
MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
endValues.view.setBackground(background);
Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);
// hide child views (offset down & fade out)
if (endValues.view instanceof ViewGroup) {
ViewGroup vg = (ViewGroup) endValues.view;
for (int i = 0; i < vg.getChildCount(); i++) {
View v = vg.getChildAt(i);
v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
.setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in))
.start();
}
}
AnimatorSet transition = new AnimatorSet();
transition.playTogether(changeBounds, corners, color);
transition.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
transition.setDuration(300);
return transition;
}
示例14: animateSunblind
import android.animation.AnimatorSet; //导入方法依赖的package包/类
public static void animateSunblind(RecyclerView.ViewHolder holder, boolean goesDown) {
int holderHeight = holder.itemView.getHeight();
holder.itemView.setPivotY(goesDown == true ? 0 : holderHeight);
holder.itemView.setPivotX(holder.itemView.getHeight());
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(holder.itemView, "translationY", goesDown == true ? 300 : -300, 0);
ObjectAnimator animatorRotation = ObjectAnimator.ofFloat(holder.itemView, "rotationX", goesDown == true ? -90f : 90, 0f);
ObjectAnimator animatorScaleX = ObjectAnimator.ofFloat(holder.itemView, "scaleX", 0.5f, 1f);
animatorSet.playTogether(animatorTranslateY, animatorRotation, animatorScaleX);
animatorSet.setInterpolator(new DecelerateInterpolator(1.1f));
animatorSet.setDuration(1000);
animatorSet.start();
}
示例15: animateBackground
import android.animation.AnimatorSet; //导入方法依赖的package包/类
private void animateBackground(boolean emptyQuery) {
int toAlpha = emptyQuery ? 0 : 1;
ObjectAnimator[] objectAnimators = new ObjectAnimator[2];
objectAnimators[0] = ObjectAnimator.ofFloat(emptySearchView, "alpha", toAlpha);
objectAnimators[1] = ObjectAnimator.ofFloat(searchResult, "alpha", toAlpha);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(objectAnimators);
animatorSet.setDuration(shortAnimTime);
animatorSet.start();
}