本文整理了Java中android.animation.ObjectAnimator.ofObject()
方法的一些代码示例,展示了ObjectAnimator.ofObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.ofObject()
方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:ofObject
暂无
代码示例来源:origin: andkulikov/Transitions-Everywhere
private ObjectAnimator createMatrixAnimator(ImageView imageView, TypeEvaluator<Matrix> evaluator,
Matrix startMatrix, final Matrix endMatrix) {
return ObjectAnimator.ofObject(imageView, ANIMATED_TRANSFORM_PROPERTY,
evaluator, startMatrix, endMatrix);
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
public <T> Animator ofPointF(@Nullable T target, @NonNull PointFProperty<T> property, Path path) {
return ObjectAnimator.ofObject(target, property, null, path);
}
代码示例来源:origin: fython/MaterialStepperView
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);
}
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@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;
}
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@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);
}
代码示例来源:origin: qiujuer/Genius-Android
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;
}
代码示例来源:origin: naman14/Timber
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);
}
代码示例来源:origin: naman14/Timber
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);
}
代码示例来源:origin: commonsguy/cw-omnibus
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;
}
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
setIdentityTransforms(view);
ObjectAnimator animator = ObjectAnimator.ofObject(view, ANIMATION_MATRIX_PROPERTY,
new MatrixUtils.MatrixEvaluator(), startMatrix, endMatrix);
代码示例来源:origin: andkulikov/Transitions-Everywhere
startBounds + ", " + endBounds);
Animator anim2 = ObjectAnimator.ofObject(startDrawable, "bounds",
sRectEvaluator, startBounds, endBounds);
set.playTogether(anim2);
Animator anim3 = ObjectAnimator.ofObject(endDrawable, "bounds",
sRectEvaluator, startBounds, endBounds);
set.playTogether(anim3);
代码示例来源:origin: tarek360/RichPath
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;
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
Animator anim2 = ObjectAnimator.ofObject(startDrawable, "bounds",
sRectEvaluator, startBounds, endBounds);
set.playTogether(anim2);
Animator anim3 = ObjectAnimator.ofObject(endDrawable, "bounds",
sRectEvaluator, startBounds, endBounds);
set.playTogether(anim3);
代码示例来源:origin: andkulikov/Transitions-Everywhere
if (!startClip.equals(endClip)) {
ViewUtils.setClipBounds(view, startClip);
clipAnimator = ObjectAnimator.ofObject(view,
ChangeClipBounds.VIEW_CLIP_BOUNDS, sRectEvaluator, startClip, endClip);
clipAnimator.addListener(new AnimatorListenerAdapter() {
代码示例来源:origin: hencoder/PracticeDraw7
@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();
}
});
代码示例来源:origin: JackWHLiu/jackknife
@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();
}
代码示例来源:origin: InnoFang/Android-Code-Demos
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();
}
}
代码示例来源:origin: li2/learning-android-open-source
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);
}
}
代码示例来源:origin: ywwynm/EverythingDone
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);
}
代码示例来源:origin: ywwynm/EverythingDone
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);
}
内容来源于网络,如有侵权,请联系作者删除!