本文整理了Java中com.nineoldandroids.animation.AnimatorSet.setDuration()
方法的一些代码示例,展示了AnimatorSet.setDuration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnimatorSet.setDuration()
方法的具体详情如下:
包路径:com.nineoldandroids.animation.AnimatorSet
类名称:AnimatorSet
方法名:setDuration
[英]Sets the length of each of the current child animations of this AnimatorSet. By default, each child animation will use its own duration. If the duration is set on the AnimatorSet, then each child animation inherits this duration.
[中]设置此AnimatorSet的每个当前子动画的长度。默认情况下,每个子动画将使用自己的持续时间。如果在AnimatorSet上设置了持续时间,则每个子动画都会继承此持续时间。
代码示例来源:origin: stackoverflow.com
ArrayList<ObjectAnimator> arrayListObjectAnimators = new ArrayList<ObjectAnimator>(); //ArrayList of ObjectAnimators
ObjectAnimator animY = ObjectAnimator.ofFloat(view, "y", 100f);
arrayListObjectAnimators.add(animY);
ObjectAnimator animX = ObjectAnimator.ofFloat(view, "x", 0f);
arrayListObjectAnimators.add(animX);
...
ObjectAnimator[] objectAnimators = arrayListObjectAnimators.toArray(new ObjectAnimator[arrayListObjectAnimators.size()]);
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.playTogether(objectAnimators);
animSetXY.setDuration(1000);//1sec
animSetXY.start();
代码示例来源:origin: stackoverflow.com
animators.setDuration(1000L);
animators.playTogether(xTranslate, yTranslate);
animators.addListener(new AnimatorListener() {
代码示例来源:origin: zzz40500/android-shapeLoadingView
mDownAnimatorSet.setDuration(ANIMATION_DURATION);
mDownAnimatorSet.setInterpolator(new AccelerateInterpolator(FACTOR));
mDownAnimatorSet.addListener(new Animator.AnimatorListener() {
代码示例来源:origin: zzz40500/android-shapeLoadingView
mUpAnimatorSet.playTogether(objectAnimator, objectAnimator1, scaleIndication);
mUpAnimatorSet.setDuration(ANIMATION_DURATION);
mUpAnimatorSet.setInterpolator(new DecelerateInterpolator(FACTOR));
代码示例来源:origin: stackoverflow.com
AnimatorSet as = new AnimatorSet();
as.playSequentially(ObjectAnimator.ofFloat(...), // anim 1
ObjectAnimator.ofFloat(...), // anim 2
ObjectAnimator.ofFloat(...), // anim 3
ObjectAnimator.ofFloat(...)); // anim 4
as.setDuration(600);
as.start();
代码示例来源:origin: ddwhan0123/CuteEditTextGit
/**
* start to animate
*/
public void start() {
mAnimatorSet.setDuration(mDuration);
mAnimatorSet.start();
}
代码示例来源:origin: stackoverflow.com
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(customView,
"translation", 0, destX - srcX, 0, destY - srcY);
objectAnimator.setDuration((long) MGConstantANIMATE_DURATION);
ObjectAnimator rotation = ObjectAnimator.ofFloat(customView,
"rotation", 0, degree);
rotation .setDuration((long) MGConstantANIMATE_DURATION);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration((long) MGConstantANIMATE_DURATION);
animatorSet.play(objectAnimator).after(rotation);
customView.setBackgroundResource(R.drawable.your_image);
代码示例来源:origin: stackoverflow.com
AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 0.0f),
ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 0.0f),
);
set.setDuration(500).start();
代码示例来源:origin: stackoverflow.com
AnimatorSet animSet = new AnimatorSet();
animSet.playTogether(
ObjectAnimator.ofFloat(myView, "rotationX", 0, 360),
ObjectAnimator.ofFloat(myView, "rotationY", 0, 180),
ObjectAnimator.ofFloat(myView, "rotation", 0, -90),
ObjectAnimator.ofFloat(myView, "translationX", 0, 90),
ObjectAnimator.ofFloat(myView, "translationY", 0, 90),
ObjectAnimator.ofFloat(myView, "scaleX", 1, 1.5f),
ObjectAnimator.ofFloat(myView, "scaleY", 1, 0.5f),
ObjectAnimator.ofFloat(myView, "alpha", 1, 0.25f, 1)
);
animSet.setDuration(5000).start();
代码示例来源:origin: stackoverflow.com
AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(myView, "rotationX", 0, 360),
ObjectAnimator.ofFloat(myView, "translationX", 0, 90),
ObjectAnimator.ofFloat(myView, "scaleX", 1, 1.5f),
ObjectAnimator.ofFloat(myView, "alpha", 1, 0.25f, 1));
set.setDuration(5 * 1000).start();
代码示例来源:origin: stackoverflow.com
Animator scaleX = ObjectAnimator.ofFloat(view, View.SCALE_X, 2f);
Animator scaleY = ObjectAnimator.ofFloat(view, View.SCALE_Y, 2f);
AnimatorSet animSet = new AnimatorSet();
animSet.setDuration(300).setInterpolator(new AccelerateDecelerateInterpolator());
animSet.playTogether(scaleX, scaleY);
animSet.start();
代码示例来源:origin: stackoverflow.com
private void animateDiagonalPan(View v) {
AnimatorSet animSetXY = new AnimatorSet();
ObjectAnimator y = ObjectAnimator.ofFloat(v,
"translationY",v.getY(), targetY);
ObjectAnimator x = ObjectAnimator.ofFloat(v,
"translationX", v.getX(), targetX);
animSetXY.playTogether(x, y);
animSetXY.setInterpolator(new LinearInterpolator(1f));
animSetXY.setDuration(300);
animSetXY.start();
}
代码示例来源:origin: stackoverflow.com
ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(view, TRANSLATION_X, value);
ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(view, TRANSLATION_Y, value);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(objectAnimator1, objectAnimator2);
animatorSet.setDuration(BASE_DURATION * 2);
animatorSet.start();
代码示例来源:origin: stackoverflow.com
ImageView iv = (ImageView)findViewById(R.id.markerRed);
// Create animators for x and y axes
ObjectAnimator oax = ObjectAnimator.ofFloat(iv, "translationX", 0f, 100f);
ObjectAnimator oay = ObjectAnimator.ofFloat(iv, "translationY", 0f, 100f);
oax.setRepeatCount(Animation.INFINITE);
oay.setRepeatCount(Animation.INFINITE);
// Combine Animators and start them together
AnimatorSet set = new AnimatorSet();
set.setDuration(1000);
set.playTogether(oax, oay);
set.start();
代码示例来源:origin: stackoverflow.com
ObjectAnimator rightView = ObjectAnimator.ofFloat(viewgroup_right, "MyWeight", 0.5f, 1.0f);
ObjectAnimator leftView = ObjectAnimator.ofFloat(viewgroup_left, "MyWeight", 0.5f, 0.0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(1000); // 1 second of animation
animatorSet.playTogether(rightView, leftView);
animatorSet.start();
代码示例来源:origin: guohuanwen/AndroidLoadingAnimation
private AnimatorSet dropVA(float x, float y) {
AnimatorSet animatorSet = new AnimatorSet();
PropertyValuesHolder p1 = PropertyValuesHolder.ofFloat("translationX", x);
PropertyValuesHolder p2 = PropertyValuesHolder.ofFloat("translationY", y);
animatorSet.play(ObjectAnimator.ofPropertyValuesHolder(view, p1, p2));
//setDuration在play后面设置
animatorSet.setDuration(duration);
animatorSet.setInterpolator(new AccelerateInterpolator());
return animatorSet;
}
代码示例来源:origin: stackoverflow.com
public static AnimatorSet reverseSequentialAnimatorSet(AnimatorSet animatorSet) {
ArrayList<Animator> animators = animatorSet.getChildAnimations();
Collections.reverse(animators);
AnimatorSet reversedAnimatorSet = new AnimatorSet();
reversedAnimatorSet.playSequentially(animators);
reversedAnimatorSet.setDuration(animatorSet.getDuration());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
// getInterpolator() requires API 18
reversedAnimatorSet.setInterpolator(animatorSet.getInterpolator());
}
return reversedAnimatorSet;
}
代码示例来源:origin: peng8350/JPTabBar
@Override
public void onSelectChanged(View v,boolean selected) {
AnimatorSet scaleAnimator = new AnimatorSet();
float end = selected?1.2f:1f;
ObjectAnimator scaleX ;
ObjectAnimator scaleY;
scaleX = ObjectAnimator.ofFloat(v,"scaleX",end);
scaleY = ObjectAnimator.ofFloat(v,"scaleY",end);
scaleAnimator.playTogether(scaleX,scaleY);
scaleAnimator.setDuration(300);
scaleAnimator.start();
}
代码示例来源:origin: peng8350/JPTabBar
@Override
public void onSelectChanged(View v, boolean selected) {
if(!selected)return;
AnimatorSet set= new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofFloat(v,"scaleX",0.75f,1.3f,1f,1.2f,1f);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(v,"scaleY",0.75f,1.3f,1f,1.2f,1f);
set.playTogether(animator1,animator2);
set.setDuration(800);
set.start();
}
代码示例来源:origin: stackoverflow.com
//set up the scale and fade animation set
AnimatorSet scaleAndFadeSet = new AnimatorSet();
scaleAndFadeSet.playTogether( ValueAnimator.ofFloat(myButton, "alpha", 1.0f, 0f), ObjectAnimator.ofFloat(myButton, "scale", 2.0f, 0f));
// the top level animation set
AnimatorSet set = new AnimatorSet();
set.playTogether(ObjectAnimator.ofFloat(myButton, "scale", 0, 2.0f),scaleAndFadeSet);
set.setDuration(1000);// 1s animation
set.start();
内容来源于网络,如有侵权,请联系作者删除!