private ObjectAnimator createMatrixAnimator(ImageView imageView, TypeEvaluator<Matrix> evaluator, Matrix startMatrix, final Matrix endMatrix) { return ObjectAnimator.ofObject(imageView, ANIMATED_TRANSFORM_PROPERTY, evaluator, startMatrix, endMatrix); }
@Override public <T> Animator ofPointF(@Nullable T target, @NonNull PointFProperty<T> property, Path path) { return ObjectAnimator.ofObject(target, property, null, path); }
static ObjectAnimator createArgbAnimator(View view, String propertyName, int startColor, int endColor) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return ObjectAnimator.ofObject(view, propertyName, new TypeEvaluator() { @Override public Object evaluate(float fraction, Object startValue, Object endValue) { int startInt = (Integer) startValue; int startA = (startInt >> 24) & 0xff; int startR = (startInt >> 16) & 0xff; int startG = (startInt >> 8) & 0xff; int startB = startInt & 0xff; int endInt = (Integer) endValue; int endA = (endInt >> 24) & 0xff; int endR = (endInt >> 16) & 0xff; int endG = (endInt >> 8) & 0xff; int endB = endInt & 0xff; return (startA + (int)(fraction * (endA - startA))) << 24 | (startR + (int)(fraction * (endR - startR))) << 16 | (startG + (int)(fraction * (endG - startG))) << 8 | (startB + (int)(fraction * (endB - startB))); } }, startColor, endColor); } else { return ObjectAnimator.ofArgb(view, propertyName, startColor, endColor); } }
@Nullable @Override public Animator createAnimator(@NonNull ViewGroup sceneRoot, @Nullable TransitionValues startValues, @Nullable TransitionValues endValues) { if (startValues != null && endValues != null) { float startX = (float) startValues.values.get(TRANSLATION_X); float startY = (float) startValues.values.get(TRANSLATION_Y); float endX = (float) endValues.values.get(TRANSLATION_X); float endY = (float) endValues.values.get(TRANSLATION_Y); endValues.view.setTranslationX(startX); endValues.view.setTranslationY(startY); if (Build.VERSION.SDK_INT >= 21 && TRANSLATION_PROPERTY != null) { Path path = getPathMotion().getPath(startX, startY, endX, endY); return ObjectAnimator.ofObject(endValues.view, TRANSLATION_PROPERTY, null, path); } else { Animator x = (startX == endX) ? null : ObjectAnimator.ofFloat(endValues.view, View.TRANSLATION_X, startX, endX); Animator y = (startY == endY) ? null : ObjectAnimator.ofFloat(endValues.view, View.TRANSLATION_Y, startY, endY); return TransitionUtils.mergeAnimators(x, y); } } else { return null; } }
@Nullable @Override public Animator createAnimator(@NonNull final ViewGroup sceneRoot, @Nullable TransitionValues startValues, @Nullable TransitionValues endValues) { if (startValues == null || endValues == null || !startValues.values.containsKey(PROPNAME_CLIP) || !endValues.values.containsKey(PROPNAME_CLIP)) { return null; } Rect start = (Rect) startValues.values.get(PROPNAME_CLIP); Rect end = (Rect) endValues.values.get(PROPNAME_CLIP); if (start == null && end == null) { return null; // No animation required since there is no clip. } if (start == null) { start = (Rect) startValues.values.get(PROPNAME_BOUNDS); } else if (end == null) { end = (Rect) endValues.values.get(PROPNAME_BOUNDS); } if (start.equals(end)) { return null; } ViewUtils.setClipBounds(endValues.view, start); RectEvaluator evaluator = new RectEvaluator(new Rect()); return ObjectAnimator.ofObject(endValues.view, VIEW_CLIP_BOUNDS, evaluator, start, end); }
private ObjectAnimator getTitleAnimator() { if (mAnimator == null) { if (mCurTitleProperty == null) mCurTitleProperty = new TitleProperty(); mAnimator = ObjectAnimator.ofObject(this, TITLE_PROPERTY, new TitleEvaluator(mCurTitleProperty), mCurTitleProperty); mAnimator.setDuration(ANIMATION_DURATION); mAnimator.setInterpolator(ANIMATION_INTERPOLATOR); } else { mAnimator.cancel(); } return mAnimator; }
public ObjectAnimator animate(int end) { float[][] startPoints = NumberUtils.getControlPointsFor(-1); float[][] endPoints = NumberUtils.getControlPointsFor(end); return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints); }
public ObjectAnimator animate(int start, int end) { float[][] startPoints = NumberUtils.getControlPointsFor(start); float[][] endPoints = NumberUtils.getControlPointsFor(end); return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints); }
private void animateMarker() { map.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 48)); Property<Marker, LatLng> property= Property.of(Marker.class, LatLng.class, "position"); ObjectAnimator animator= ObjectAnimator.ofObject(markerToAnimate, property, new LatLngEvaluator(), nextAnimationEnd); animator.setDuration(2000); animator.start(); if (nextAnimationEnd == LINCOLN_CENTER) { nextAnimationEnd=PENN_STATION; } else { nextAnimationEnd=LINCOLN_CENTER; } }
setIdentityTransforms(view); ObjectAnimator animator = ObjectAnimator.ofObject(view, ANIMATION_MATRIX_PROPERTY, new MatrixUtils.MatrixEvaluator(), startMatrix, endMatrix);
public AnimationBuilder pathData(String... pathData) { PathDataNode[][] pathDataNodes = new PathDataNode[pathData.length][]; for (int i = 0; i < pathData.length; i++) { pathDataNodes[i] = PathParserCompat.createNodesFromPathData(pathData[i]); } if (!PathParserCompat.canMorph(pathDataNodes)) { Log.w("RichPathAnimator", "the paths aren't compatible for morphing. The paths should have exact same length of commands, and exact same length of parameters for each command"); return this; } for (final RichPath path : paths) { ObjectAnimator objectAnimator = ObjectAnimator.ofObject(path, "pathDataNodes", new PathEvaluator(), pathDataNodes); applyAnimatorProperties(objectAnimator, path); } return this; }
if (!startClip.equals(endClip)) { ViewUtils.setClipBounds(view, startClip); clipAnimator = ObjectAnimator.ofObject(view, ChangeClipBounds.VIEW_CLIP_BOUNDS, sRectEvaluator, startClip, endClip); clipAnimator.addListener(new AnimatorListenerAdapter() {
@Override public void onClick(View v) { ObjectAnimator animator = ObjectAnimator.ofObject(view, "position", new PointFEvaluator(), new PointF(0, 0), new PointF(1, 1)); animator.setInterpolator(new LinearInterpolator()); animator.setDuration(1000); animator.start(); } });
@Override public void startAnimation(View view, int duration) { super.startAnimation(view, duration); mTargetView = view; mActionTree.add(0, (PA) new MoveTo(0, 0)); ObjectAnimator animator = ObjectAnimator.ofObject(this, PATH, new PathEvaluator(), mActionTree.toArray()); animator.setDuration(duration); animator.start(); }
private void startSunPulsateAnimation() { ObjectAnimator sunPulsateAnimator = ObjectAnimator.ofObject(mSunView, "backgroundColor", new ArgbEvaluator(), mColdSunColor, mHeatSunColor) .setDuration(1000); sunPulsateAnimator.setRepeatMode(ValueAnimator.REVERSE); sunPulsateAnimator.setRepeatCount(ValueAnimator.INFINITE); sunPulsateAnimator.start(); } }
private void createAnimation() { if (bounceAnim == null) { XYHolder startXY = new XYHolder(0f, 0f); XYHolder endXY = new XYHolder(300f, 500f); bounceAnim = ObjectAnimator.ofObject(ballHolder, "xY", new XYEvaluator(), endXY); bounceAnim.setDuration(1500); bounceAnim.addUpdateListener(this); } }
public ObjectAnimator animate(int start, int end) { float[][] startPoints = NumberUtils.getControlPointsFor(start); float[][] endPoints = NumberUtils.getControlPointsFor(end); return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints); }
public ObjectAnimator animate(int end) { float[][] startPoints = NumberUtils.getControlPointsFor(-1); float[][] endPoints = NumberUtils.getControlPointsFor(end); return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints); }