mNeedleAnim = ObjectAnimator.ofFloat(mNeedle, "rotation", -30, 0); mNeedleAnim.setDuration(200); mNeedleAnim.setRepeatMode(0); mNeedleAnim.setInterpolator(new LinearInterpolator());
objectAnimator1.setRepeatMode(ValueAnimator.INFINITE); objectAnimator2.setRepeatMode(ValueAnimator.INFINITE); objectAnimator3.setRepeatMode(ValueAnimator.INFINITE);
mNeedleAnim.setRepeatMode(0); mNeedleAnim.setInterpolator(new LinearInterpolator());
ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(ImageView, PropertyValuesHolder.ofFloat("scaleX", 1.2f), PropertyValuesHolder.ofFloat("scaleY", 1.2f)); scaleDown.setDuration(310); scaleDown.setRepeatCount(ObjectAnimator.INFINITE); scaleDown.setRepeatMode(ObjectAnimator.REVERSE); scaleDown.start();
private ObjectAnimator create(View target, String propertyName, int repeatCount, long delay, float from, float to) { ObjectAnimator animator = ObjectAnimator.ofFloat(target, propertyName, from, to); animator.setRepeatCount(repeatCount); animator.setRepeatMode(ObjectAnimator.RESTART); animator.setStartDelay(delay); return animator; }
@OnClick(R.id.runButton) public void runButtonClick() { if (infiniteAnimator == null) { infiniteAnimator = ObjectAnimator.ofInt(roadRunner, ProgressRoadRunner.PROGRESS, 100); infiniteAnimator.setDuration(1000); infiniteAnimator.setRepeatMode(ObjectAnimator.RESTART); infiniteAnimator.setRepeatCount(ObjectAnimator.INFINITE); infiniteAnimator.setInterpolator(new FastOutSlowInInterpolator()); } infiniteAnimator.start(); }
ObjectAnimator colorAnim = ObjectAnimator.ofInt(myButton, "textColor", Color.RED, Color.TRANSPARENT); colorAnim.setDuration(1000); colorAnim.setEvaluator(new ArgbEvaluator()); colorAnim.setRepeatCount(ValueAnimator.INFINITE); colorAnim.setRepeatMode(ValueAnimator.REVERSE); colorAnim.start();
ObjectAnimator loadAnimator = ObjectAnimator.ofFloat(imageViewList.get(i), "alpha", new float[]{1.0F, 0.5F}).setDuration(500L); loadAnimator.setStartDelay(100 * i); loadAnimator.setRepeatMode(ObjectAnimator.REVERSE); loadAnimator.setRepeatCount(-1); animatorList.add(loadAnimator);
/** * ObjectAnimator usage * * @param b * @return */ public ObjectAnimator getObjectAnimator(boolean b) { if (b) { ObjectAnimator bgColorAnimator = ObjectAnimator.ofArgb(mPuppet, "backgroundColor", 0xff009688, 0xff795548); bgColorAnimator.setRepeatCount(1); bgColorAnimator.setDuration(3000); bgColorAnimator.setRepeatMode(ValueAnimator.REVERSE); bgColorAnimator.setStartDelay(0); return bgColorAnimator; } else { ObjectAnimator rotationXAnimator = ObjectAnimator.ofFloat(mPuppet, "rotationX", 0f, 360f); rotationXAnimator.setRepeatCount(1); rotationXAnimator.setDuration(3000); rotationXAnimator.setRepeatMode(ValueAnimator.REVERSE); return rotationXAnimator; } }
/** * ObjectAnimator: You can also create multiple animations by PropertyValuesHolder. * <p> * ValueAnimator has the same method, but we don't use it that way. #ValueAnimator.ofPropertyValuesHolder()# * * @return */ public Animator getObjectAnimatorByPropertyValuesHolder() { PropertyValuesHolder bgColorAnimator = PropertyValuesHolder.ofObject("backgroundColor", new ArgbEvaluator(), 0xff009688, 0xff795548); PropertyValuesHolder rotationXAnimator = PropertyValuesHolder.ofFloat("rotationX", 0f, 360f); ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(mPuppet, bgColorAnimator, rotationXAnimator); objectAnimator.setDuration(3000); objectAnimator.setRepeatCount(1); objectAnimator.setRepeatMode(ValueAnimator.REVERSE); return objectAnimator; }
ObjectAnimator lineAnim = ObjectAnimator.ofPropertyValuesHolder( this, pvMoveY, pvMoveX).setDuration(lineAnimDuration); lineAnim.setRepeatMode(ValueAnimator.RESTART); lineAnim.setRepeatCount(mAnimPoints.size() - 1); lineAnim.addUpdateListener(this);
PropertyValuesHolder scalex = PropertyValuesHolder.ofFloat(View.SCALE_X, 1.2f); PropertyValuesHolder scaley = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1.2f); ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(btn_layer, scalex, scaley); anim.setRepeatCount(ValueAnimator.INFINITE); anim.setRepeatMode(ValueAnimator.REVERSE); anim.setDuration(1500); anim.start();
private void animateWifi() { wifiAnimator = ObjectAnimator.ofFloat(wifiIndicator, "alpha", 0f, 0.5f); wifiAnimator.setDuration(1500); wifiAnimator.setRepeatMode(ValueAnimator.RESTART); wifiAnimator.setRepeatCount(ValueAnimator.INFINITE); wifiAnimator.start(); }
public void startAnim4(View view) { final SectorView sectorView = (SectorView)findViewById(R.id.sector_view); anim4 = ObjectAnimator.ofFloat(sectorView, "fraction", 0, 1); anim4.setDuration(2000); anim4.setRepeatCount(ValueAnimator.INFINITE); anim4.setRepeatMode(ValueAnimator.RESTART); anim4.start(); }
public void startAnim1(View view) { ImageView iv = (ImageView) findViewById(R.id.iv_1); anim1 = ObjectAnimator.ofFloat(iv, "rotationY", 0, 359); anim1.setDuration(1000); anim1.setRepeatCount(1); anim1.setRepeatMode(ValueAnimator.REVERSE); anim1.start(); }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public PathAnimator loop(boolean loop) { checkObj(); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setRepeatMode(ValueAnimator.RESTART); return this; }
@Override protected void setupRepeating(Animator animation, AnimationBody animationBody) { ((ObjectAnimator) animation).setRepeatCount(animationBody.getRepeatCount() * 2 + 1); ((ObjectAnimator) animation).setRepeatMode(ValueAnimator.REVERSE); } }
@Override protected void setupRepeating(Animator animation, AnimationBody animationBody) { int repeatCount = animationBody.getRepeatCount(); if (repeatCount == 0) { repeatCount = 3; } else { repeatCount *= 3; } ((ObjectAnimator) animation).setRepeatCount(repeatCount); ((ObjectAnimator) animation).setRepeatMode(ValueAnimator.REVERSE); } }
public PropertyAnimator repeat(int count, int repeatMode) { checkObj(); animator.setRepeatCount(count); animator.setRepeatMode(repeatMode); return this; }
private ObjectAnimator createDotJumpAnimator(JumpingSpan jumpingSpan, long delay) { ObjectAnimator jumpAnimator = ObjectAnimator.ofFloat(jumpingSpan, "translationY", 0, -jumpHeight); jumpAnimator.setEvaluator(new SinTypeEvaluator()); jumpAnimator.setDuration(period); jumpAnimator.setStartDelay(delay); jumpAnimator.setRepeatCount(ValueAnimator.INFINITE); jumpAnimator.setRepeatMode(ValueAnimator.RESTART); return jumpAnimator; }