本文整理汇总了Java中android.animation.ObjectAnimator.setDuration方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.setDuration方法的具体用法?Java ObjectAnimator.setDuration怎么用?Java ObjectAnimator.setDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.setDuration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animateShutter
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateShutter() {
vShutter.setVisibility(View.VISIBLE);
vShutter.setAlpha(0.f);
ObjectAnimator alphaInAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0f, 0.8f);
alphaInAnim.setDuration(100);
alphaInAnim.setStartDelay(100);
alphaInAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
ObjectAnimator alphaOutAnim = ObjectAnimator.ofFloat(vShutter, "alpha", 0.8f, 0f);
alphaOutAnim.setDuration(200);
alphaOutAnim.setInterpolator(DECELERATE_INTERPOLATOR);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(alphaInAnim, alphaOutAnim);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
vShutter.setVisibility(View.GONE);
}
});
animatorSet.start();
}
示例2: animateMenuItemOpen
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
void animateMenuItemOpen(View view,long delay){
ObjectAnimator animScaleX = ObjectAnimator.ofFloat(view,"scaleX",0.0f,1.0f);
ObjectAnimator animScaleY = ObjectAnimator.ofFloat(view,"scaleY",0.0f,1.0f);
ObjectAnimator animAlpha = ObjectAnimator.ofFloat(view,"alpha",0,ITEM_FINAL_ALPHA);
ObjectAnimator animRotation = ObjectAnimator.ofFloat(view,"rotation",0,360.0f);
final int X_SCALE_ANIMATION_DURATION = 300;
final int Y_SCALE_ANIMATION_DURATION = 300;
animScaleX.setDuration(X_SCALE_ANIMATION_DURATION);
animScaleY.setDuration(Y_SCALE_ANIMATION_DURATION);
animRotation.setDuration(200);
AnimatorSet animSet = new AnimatorSet();
if(allowItemRotationAnim)
animSet.playTogether(animScaleX,animScaleY,animAlpha,animRotation);
else
animSet.playTogether(animScaleX,animScaleY,animAlpha);
animSet.setStartDelay(delay);
animSet.setInterpolator(new AccelerateDecelerateInterpolator());
animSet.start();
}
示例3: rotateFloatingButton
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void rotateFloatingButton(){
ObjectAnimator animator = isMenuOpen ? ObjectAnimator.ofFloat(mFloatingActionButton
, "rotation", 45F, 0f) : ObjectAnimator.ofFloat(mFloatingActionButton, "rotation", 0f, 45f);
animator.setDuration(150);
animator.setInterpolator(new LinearInterpolator());
animator.start();
}
示例4: createAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
List<Animator> animators=new ArrayList<>();
ObjectAnimator rotateAnim=ObjectAnimator.ofFloat(getTarget(),"rotation",0,180,360);
rotateAnim.setDuration(600);
rotateAnim.setRepeatCount(-1);
rotateAnim.start();
animators.add(rotateAnim);
return animators;
}
示例5: hideAddFab
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void hideAddFab() {
ObjectAnimator animator = ObjectAnimator.ofFloat(mFabAdd, "translationY", SizeUtils.dp2px(80));
animator.setDuration(150);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mFabAdd.setVisibility(View.GONE);
}
});
animator.start();
}
示例6: animateXY
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Animates the drawing / rendering of the chart on both x- and y-axis with
* the specified animation time. If animate(...) is called, no further
* calling of invalidate() is necessary to refresh the chart.
*
* @param durationMillisX
* @param durationMillisY
* @param easingX
* @param easingY
*/
public void animateXY(int durationMillisX, int durationMillisY, EasingFunction easingX,
EasingFunction easingY) {
if (android.os.Build.VERSION.SDK_INT < 11)
return;
ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
animatorY.setInterpolator(easingY);
animatorY.setDuration(
durationMillisY);
ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0f, 1f);
animatorX.setInterpolator(easingX);
animatorX.setDuration(
durationMillisX);
// make sure only one animator produces update-callbacks (which then
// call invalidate())
if (durationMillisX > durationMillisY) {
animatorX.addUpdateListener(mListener);
} else {
animatorY.addUpdateListener(mListener);
}
animatorX.start();
animatorY.start();
}
示例7: showBottomBar
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void showBottomBar() {
mRlBottomBar.setVisibility(View.VISIBLE);
// bottombar进行一个上移的动画
ObjectAnimator animator = ObjectAnimator.ofFloat(mRlBottomBar, "translationY", SizeUtils.dp2px(56), 0);
animator.setDuration(300);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
}
});
animator.start();
}
示例8: createAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationX",0,360);
ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(1500);
animator.start();
List<Animator> animators=new ArrayList<>();
animators.add(animator);
return animators;
}
示例9: changeDigit
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void changeDigit(TimelyView tv, int start, int end) {
try {
ObjectAnimator obja = tv.animate(start, end);
obja.setDuration(400);
obja.start();
} catch (InvalidParameterException e) {
e.printStackTrace();
}
}
示例10: showText
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
public void showText(TextView textView, String text, int fromColor, int toColor) {
textView.setText(text);
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(textView, "textColor", fromColor, toColor);
objectAnimator.setEvaluator(new ArgbEvaluator());
objectAnimator.setDuration(300);
objectAnimator.setRepeatCount(0);
objectAnimator.start();
}
示例11: animateOutlineAlpha
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateOutlineAlpha(final View child, CustomViewOutlineProvider outlineProvider) {
ObjectAnimator animator = ObjectAnimator.ofFloat(outlineProvider, "alpha", 0, shadowAlpha);
animator.setDuration(animationDuration);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
child.invalidateOutline();
}
});
animator.start();
}
示例12: animateY
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Animates the rendering of the chart on the y-axis with the specified
* animation time. If animate(...) is called, no further calling of
* invalidate() is necessary to refresh the chart.
*
* @param durationMillis
*/
public void animateY(int durationMillis) {
if (android.os.Build.VERSION.SDK_INT < 11)
return;
ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
animatorY.setDuration(durationMillis);
animatorY.addUpdateListener(mListener);
animatorY.start();
}
示例13: createAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
List<Animator> animators=new ArrayList<>();
PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatCount(-1);
animator.setDuration(2500);
animator.start();
animators.add(animator);
return animators;
}
示例14: createCustomAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void createCustomAnimation() {
AnimatorSet set = new AnimatorSet();
ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleX", 1.0f, 0.2f);
ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleY", 1.0f, 0.2f);
ObjectAnimator scaleInX = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleX", 0.2f, 1.0f);
ObjectAnimator scaleInY = ObjectAnimator.ofFloat(fabNote.getMenuIconView(), "scaleY", 0.2f, 1.0f);
scaleOutX.setDuration(50);
scaleOutY.setDuration(50);
scaleInX.setDuration(150);
scaleInY.setDuration(150);
scaleInX.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
fabNote.getMenuIconView().setImageResource(fabNote.isOpened() ? R.mipmap.fab_add : R.mipmap.ic_edit);
}
});
set.play(scaleOutX).with(scaleOutY);
set.play(scaleInX).with(scaleInY).after(scaleOutX);
set.setInterpolator(new OvershootInterpolator(2));
fabNote.setIconToggleAnimatorSet(set);
}
示例15: fadeAnimation
import android.animation.ObjectAnimator; //导入方法依赖的package包/类
private void fadeAnimation(final View v){
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(v, "alpha", 1f, .0f);
fadeOut.setDuration(500);
fadeOut.start();
}