本文整理了Java中android.animation.ObjectAnimator.ofFloat()
方法的一些代码示例,展示了ObjectAnimator.ofFloat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator.ofFloat()
方法的具体详情如下:
包路径:android.animation.ObjectAnimator
类名称:ObjectAnimator
方法名:ofFloat
暂无
代码示例来源:origin: nickbutcher/plaid
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
TransitionValues endValues) {
return ObjectAnimator.ofFloat(endValues.view, View.TRANSLATION_Z,
initialElevation, finalElevation);
}
代码示例来源:origin: wasabeef/recyclerview-animators
@Override protected Animator[] getAnimators(View view) {
ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", mFrom, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", mFrom, 1f);
return new ObjectAnimator[] { scaleX, scaleY };
}
}
代码示例来源:origin: wasabeef/recyclerview-animators
@Override protected Animator[] getAnimators(View view) {
return new Animator[] { ObjectAnimator.ofFloat(view, "alpha", mFrom, 1f) };
}
}
代码示例来源:origin: aa112901/remusic
public void initTranlationAnimate(float start, float stop) {
mObjectAnimator1 = ObjectAnimator.ofFloat(this, "translationX", start, stop);
//mObjectAnimator1.setDuration(390);
//mObjectAnimator1.setInterpolator(new LinearInterpolator());
//mObjectAnimator1.setRepeatCount(0);
}
代码示例来源:origin: aa112901/remusic
public void initTranlationAnimate1(float start, float stop) {
mObjectAnimator3 = ObjectAnimator.ofFloat(this, "translationX", start, stop);
//mObjectAnimator3.setDuration(200);
//mObjectAnimator3.setInterpolator(new LinearInterpolator());
// mObjectAnimator3.setRepeatCount(0);
}
代码示例来源:origin: wasabeef/recyclerview-animators
@Override protected Animator[] getAnimators(View view) {
return new Animator[] {
ObjectAnimator.ofFloat(view, "translationY", view.getMeasuredHeight(), 0)
};
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@RequiresApi(11)
private ObjectAnimator yAnimator(int duration, EasingFunction easing) {
ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
animatorY.setInterpolator(easing);
animatorY.setDuration(duration);
return animatorY;
}
代码示例来源:origin: PhilJay/MPAndroidChart
@RequiresApi(11)
private ObjectAnimator xAnimator(int duration, EasingFunction easing) {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0f, 1f);
animatorX.setInterpolator(easing);
animatorX.setDuration(duration);
return animatorX;
}
代码示例来源:origin: PhilJay/MPAndroidChart
public AnimatedViewPortJob(ViewPortHandler viewPortHandler, float xValue, float yValue, Transformer trans, View v, float xOrigin, float yOrigin, long duration) {
super(viewPortHandler, xValue, yValue, trans, v);
this.xOrigin = xOrigin;
this.yOrigin = yOrigin;
animator = ObjectAnimator.ofFloat(this, "phase", 0f, 1f);
animator.setDuration(duration);
animator.addUpdateListener(this);
animator.addListener(this);
}
代码示例来源:origin: frogermcs/InstaMaterial
private void setupSimulateProgressAnimator() {
simulateProgressAnimator = ObjectAnimator.ofFloat(this, "currentProgress", 0, 100).setDuration(2000);
simulateProgressAnimator.setInterpolator(new AccelerateInterpolator());
simulateProgressAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
changeState(STATE_DONE_STARTED);
}
});
}
代码示例来源:origin: frogermcs/InstaMaterial
private void setupDoneAnimators() {
doneBgAnimator = ObjectAnimator.ofFloat(this, "currentDoneBgOffset", MAX_DONE_BG_OFFSET, 0).setDuration(300);
doneBgAnimator.setInterpolator(new DecelerateInterpolator());
checkmarkAnimator = ObjectAnimator.ofFloat(this, "currentCheckmarkOffset", MAX_DONE_IMG_OFFSET, 0).setDuration(300);
checkmarkAnimator.setInterpolator(new OvershootInterpolator());
checkmarkAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
changeState(STATE_FINISHED);
}
});
}
代码示例来源:origin: wasabeef/recyclerview-animators
@Override protected Animator[] getAnimators(View view) {
return new Animator[] {
ObjectAnimator.ofFloat(view, "translationX", -view.getRootView().getWidth(), 0)
};
}
}
代码示例来源:origin: wasabeef/recyclerview-animators
@Override protected Animator[] getAnimators(View view) {
return new Animator[] {
ObjectAnimator.ofFloat(view, "translationX", view.getRootView().getWidth(), 0)
};
}
}
代码示例来源:origin: nickbutcher/plaid
private Animator createAnimator(
final View view, float startTranslationY, float endTranslationY) {
view.setTranslationY(startTranslationY);
final List<Boolean> ancestralClipping = TransitionUtils.setAncestralClipping(view, false);
Animator transition = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, endTranslationY);
transition.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
TransitionUtils.restoreAncestralClipping(view, ancestralClipping);
}
});
return transition;
}
}
代码示例来源:origin: naman14/Timber
private void showBubble() {
AnimatorSet animatorSet = new AnimatorSet();
bubble.setVisibility(VISIBLE);
if (currentAnimator != null)
currentAnimator.cancel();
currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION);
currentAnimator.start();
}
代码示例来源:origin: aa112901/remusic
public void initRotateAnimation(float start) {
mObjectAnimator = ObjectAnimator.ofFloat(this, "rotation", start, 360f + start);
mObjectAnimator.setDuration(DEFAULT_DURATION);
mObjectAnimator.setInterpolator(new LinearInterpolator());
mObjectAnimator.setRepeatCount(ObjectAnimator.INFINITE);
}
代码示例来源:origin: gzu-liyujiang/AndroidPicker
@Override
protected void showAfter() {
View rootView = getRootView();
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator alpha = ObjectAnimator.ofFloat(rootView, "alpha", 0, 1);
ObjectAnimator translation = ObjectAnimator.ofFloat(rootView, "translationY", 300, 0);
animatorSet.playTogether(alpha, translation);
animatorSet.setDuration(1000);
animatorSet.setInterpolator(new AccelerateInterpolator());
animatorSet.start();
}
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
View target = holder.itemView;
View icon = target.findViewById(R.id.icon);
Animator swing = ObjectAnimator.ofFloat(icon, "rotationX", 45, 0);
swing.setInterpolator(new OvershootInterpolator(5));
View right = holder.itemView.findViewById(R.id.right);
Animator rotateIn = ObjectAnimator.ofFloat(right, "rotationY", 90, 0);
rotateIn.setInterpolator(new DecelerateInterpolator());
AnimatorSet animator = new AnimatorSet();
animator.setDuration(getAddDuration());
animator.playTogether(swing, rotateIn);
animator.start();
}
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Applys a spin animation to the Chart.
*
* @param durationmillis
* @param fromangle
* @param toangle
*/
@SuppressLint("NewApi")
public void spin(int durationmillis, float fromangle, float toangle, EasingFunction easing) {
setRotationAngle(fromangle);
ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle,
toangle);
spinAnimator.setDuration(durationmillis);
spinAnimator.setInterpolator(easing);
spinAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
postInvalidate();
}
});
spinAnimator.start();
}
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
@Nullable
public ObjectAnimator ofFloat(@Nullable View view, @NonNull Property<View, Float> property,
float startFraction, float endFraction) {
float start = property.get(view) * startFraction;
float end = property.get(view) * endFraction;
if (start == end) {
return null;
}
property.set(view, start);
return ObjectAnimator.ofFloat(view, property, end);
}
内容来源于网络,如有侵权,请联系作者删除!