本文整理汇总了Java中com.nineoldandroids.animation.ObjectAnimator.ofFloat方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectAnimator.ofFloat方法的具体用法?Java ObjectAnimator.ofFloat怎么用?Java ObjectAnimator.ofFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.ofFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCircularReveal
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Returns an Animator which can animate a clipping circle.
* <p/>
* Any shadow cast by the View will respect the circular clip from this animator.
* <p/>
* Only a single non-rectangular clip can be applied on a View at any time.
* Views clipped by a circular reveal animation take priority over
* {@link View#setClipToOutline(boolean) View Outline clipping}.
* <p/>
* Note that the animation returned here is a one-shot animation. It cannot
* be re-used, and once started it cannot be paused or resumed.
*
* @param view The View will be clipped to the animating circle.
* @param centerX The x coordinate of the center of the animating circle.
* @param centerY The y coordinate of the center of the animating circle.
* @param startRadius The starting radius of the animating circle.
* @param endRadius The ending radius of the animating circle.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SupportAnimator createCircularReveal(View view,
int centerX, int centerY,
float startRadius, float endRadius) {
if (!(view.getParent() instanceof RevealAnimator)) {
throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout.");
}
RevealAnimator revealLayout = (RevealAnimator) view.getParent();
revealLayout.attachRevealInfo(new RevealInfo(centerX, centerY, startRadius, endRadius,
new WeakReference<>(view)));
if (LOLLIPOP_PLUS) {
return new SupportAnimatorLollipop(android.view.ViewAnimationUtils
.createCircularReveal(view, centerX, centerY, startRadius, endRadius), revealLayout);
}
ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, CLIP_RADIUS,
startRadius, endRadius);
reveal.addListener(getRevealFinishListener(revealLayout));
return new SupportAnimatorPreL(reveal, revealLayout);
}
示例2: createAnimation
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public List<Animator> createAnimation() {
List<Animator> animators=new ArrayList<>();
ValueAnimator scaleAnim=ValueAnimator.ofFloat(0.5f,1,0.5f);
scaleAnim.setDuration(1000);
scaleAnim.setRepeatCount(-1);
scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
scaleFloat = (float) animation.getAnimatedValue();
postInvalidate();
}
});
scaleAnim.start();
ObjectAnimator rotateAnim=ObjectAnimator.ofFloat(getTarget(),"rotation",0,180,360);
rotateAnim.setDuration(1000);
rotateAnim.setRepeatCount(-1);
rotateAnim.start();
animators.add(scaleAnim);
animators.add(rotateAnim);
return animators;
}
示例3: dismissShowdown
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* 隐藏模糊背景
*/
protected void dismissShowdown() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
objectAnimator.setDuration(400);
objectAnimator.start();
objectAnimator.addListener(new SimpleAnimationListener() {
@Override
public void onAnimationEnd(Animator animation) {
mParentVG.removeView(mBg);
}
});
}
示例4: startDiscAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startDiscAnimator(float animatedValue) {
mDiscLayoutAnimator = ObjectAnimator.ofFloat(mDiscLayout, "rotation", animatedValue, 360 + animatedValue);
mDiscLayoutAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator arg0) {
mDiscLayoutAnimatorValue = (Float) arg0.getAnimatedValue();
}
});
mDiscLayoutAnimator.setDuration(DISC_ANIMATOR_TIME);
mDiscLayoutAnimator.setRepeatCount(DISC_ANIMATOR_REPEAT_COUNT);
mDiscLayoutAnimator.setInterpolator(new LinearInterpolator());
if (mDiscLayoutAnimator.isRunning() || mDiscLayoutAnimator.isStarted()) {
mDiscLayoutAnimator.cancel();
}
mDiscLayoutAnimator.start();
}
示例5: animateView
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void animateView(final ViewGroup parent, final View view) {
if (mAnimationStartMillis == -1) {
mAnimationStartMillis = System.currentTimeMillis();
}
ViewHelper.setAlpha(view, 0);
Animator[] childAnimators;
if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
} else {
childAnimators = new Animator[0];
}
Animator[] animators = getAnimators(parent, view);
Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);
AnimatorSet set = new AnimatorSet();
set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
set.setStartDelay(calculateAnimationDelay());
set.setDuration(getAnimationDurationMillis());
set.start();
mAnimators.put(view.hashCode(), set);
}
示例6: rotateY
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* Animates transition between current rotateY to target rotateY
*
* @param rotationY
* @param duration
* @param interpolator
* @param isFrom
* @return
*/
@NonNull
public Animator rotateY(float rotationY, float duration, @Nullable Interpolator interpolator, boolean isFrom) {
Animator animator;
if (isFrom) {
animator = ObjectAnimator.ofFloat(mView, "rotationY", rotationY, ViewHelper.getRotationX(mView));
} else {
animator = ObjectAnimator.ofFloat(mView, "rotationY", ViewHelper.getRotationX(mView), rotationY);
}
setProperties(animator, duration, interpolator);
return animator;
}
示例7: getBottomLinesAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private ObjectAnimator getBottomLinesAnimator(float destBottomLines) {
if (bottomLinesAnimator == null) {
bottomLinesAnimator = ObjectAnimator.ofFloat(this, "currentBottomLines", destBottomLines);
} else {
bottomLinesAnimator.cancel();
bottomLinesAnimator.setFloatValues(destBottomLines);
}
return bottomLinesAnimator;
}
示例8: animateCheck
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
public void animateCheck() {
changeBackground();
ObjectAnimator objectAnimator;
if (iSchecked) {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin);
} else {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni);
}
objectAnimator.setDuration(300);
objectAnimator.start();
}
示例9: runEnterAnimation
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* The enter animation scales the picture in from its previous thumbnail
* size/location, colorizing it in parallel. In parallel, the background of the
* activity is fading in. When the pictue is in place, the text description
* drops down.
*/
private void runEnterAnimation() {
final long duration = ANIM_DURATION;
// Set starting values for properties we're going to animate. These
// values scale and position the full size version down to the thumbnail
// size/location, from which we'll animate it back up
ViewHelper.setPivotX(mViewPager, 0);
ViewHelper.setPivotY(mViewPager, 0);
ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth());
ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight());
ViewHelper.setTranslationX(mViewPager, thumbnailLeft);
ViewHelper.setTranslationY(mViewPager, thumbnailTop);
// Animate scale and translation to go from thumbnail to full size
ViewPropertyAnimator.animate(mViewPager)
.setDuration(duration)
.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());
// Fade in the black background
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255);
bgAnim.setDuration(duration);
bgAnim.start();
// Animate a color filter to take the image from grayscale to full color.
// This happens in parallel with the image scaling and moving into place.
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this,
"saturation", 0, 1);
colorizer.setDuration(duration);
colorizer.start();
}
示例10: getLabelAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private ObjectAnimator getLabelAnimator() {
if (labelAnimator == null) {
labelAnimator = ObjectAnimator.ofFloat(this, "floatingLabelFraction", 0f, 1f);
}
labelAnimator.setDuration(floatingLabelAnimating ? 300 : 0);
return labelAnimator;
}
示例11: startErrorMultilineAnimator
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
private void startErrorMultilineAnimator(float destLines) {
if (errorLabelAnimator == null) {
errorLabelAnimator = ObjectAnimator.ofFloat(this, "currentNbErrorLines", destLines);
} else {
errorLabelAnimator.setFloatValues(destLines);
}
errorLabelAnimator.start();
}
示例12: createTranslationAnimations
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
/**
* 创建移动动画
*
* @param view
* @param startX
* @param endX
* @param startY
* @param endY
* @return
*/
private AnimatorSet createTranslationAnimations(View view, float startX,
float endX, float startY, float endY) {
ObjectAnimator animX = ObjectAnimator.ofFloat(view, "translationX",
startX, endX);
ObjectAnimator animY = ObjectAnimator.ofFloat(view, "translationY",
startY, endY);
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.playTogether(animX, animY);
return animSetXY;
}
示例13: DiscPageChanger
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
public DiscPageChanger(ViewPager viewPager, ImageView needle) {
mViewPager = viewPager;
mNeedle = needle;
mAnimator = ObjectAnimator.ofFloat(needle, "rotation", START_VALUE, END_VALUE);
mAnimator.setDuration(200);
mAnimator.setInterpolator(new LinearInterpolator());
mAnimator.addListener(this);
playlist = PlayerManager.getInstance(needle.getContext()).getPlaylist();
}
示例14: show
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
public void show(){
ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(1500);
animator.start();
isShow = true;
}
示例15: onRefreshing
import com.nineoldandroids.animation.ObjectAnimator; //导入方法依赖的package包/类
@Override
public void onRefreshing() {
mRefreshLoadView.setPivotX(0.5f * mRefreshLoadView.getMeasuredWidth());
mRefreshLoadView.setPivotY(0.5f * mRefreshLoadView.getMeasuredHeight());
if (animator == null) {
animator = ObjectAnimator.ofFloat(mRefreshLoadView, "rotation", 0.0f, 360.0f);
animator.setDuration(1000);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.setRepeatMode(ValueAnimator.RESTART);
}
if (animator.isRunning()) animator.cancel();
animator.start();
}