本文整理了Java中com.nineoldandroids.animation.ObjectAnimator
类的一些代码示例,展示了ObjectAnimator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectAnimator
类的具体详情如下:
包路径:com.nineoldandroids.animation.ObjectAnimator
类名称:ObjectAnimator
[英]This subclass of ValueAnimator provides support for animating properties on target objects. The constructors of this class take parameters to define the target object that will be animated as well as the name of the property that will be animated. Appropriate set/get functions are then determined internally and the animation will call these functions as necessary to animate the property.
[中]ValueAnimator的这个子类支持在目标对象上设置属性动画。此类的构造函数使用参数来定义要设置动画的目标对象以及要设置动画的属性的名称。然后在内部确定适当的设置/获取函数,动画将根据需要调用这些函数来设置属性的动画。
代码示例来源:origin: navasmdc/MaterialDesignLibrary
public void hide(){
ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(1500);
animator.start();
isShow = false;
}
代码示例来源:origin: navasmdc/MaterialDesignLibrary
animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2);
animation.setDuration(1200);
animation.addListener(new AnimatorListener() {
public void onAnimationCancel(Animator arg0) {}
});
animation.start();
代码示例来源:origin: navasmdc/MaterialDesignLibrary
/**
* Stop indeterminate animation to convert view in determinate progress bar
*/
private void stopIndeterminate(){
animation.cancel();
ViewHelper.setX(progressView,0);
runAnimation = false;
}
代码示例来源:origin: navasmdc/MaterialDesignLibrary
public void animateCheck() {
changeBackground();
ObjectAnimator objectAnimator;
if (eventCheck) {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin);
} else {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni);
}
objectAnimator.setDuration(300);
objectAnimator.start();
}
代码示例来源:origin: commonsguy/cw-omnibus
public void showLeft() {
translateWidgets(leftWidth, left, middle, right);
ObjectAnimator.ofInt(this, "middleWidth", leftWidth,
middleWidthNormal).setDuration(ANIM_DURATION)
.start();
}
代码示例来源:origin: NEYouFan/ht-refreshrecyclerview
@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();
}
代码示例来源:origin: agxxxx/AIDLMusicPlayer
private void startNeedleAnimator() {
if (isPlaying) {
mNeedleAnimator = ObjectAnimator.ofFloat(mNeedle, "rotation", 0, NEEDLE_ROTATE_CIRCLE);
} else {
mNeedleAnimator = ObjectAnimator.ofFloat(mNeedle, "rotation", NEEDLE_ROTATE_CIRCLE, 0);
}
mNeedleAnimator.setDuration(NEEDLE_ANIMATOR_TIME);
mNeedleAnimator.setInterpolator(new DecelerateInterpolator());
if (mNeedleAnimator.isRunning() || mNeedleAnimator.isStarted()) {
mNeedleAnimator.cancel();
}
mNeedleAnimator.start();
}
代码示例来源:origin: darkskygit/VirtualApp
mDownY = event.getY();
mRadiusAnimator = ObjectAnimator.ofFloat(this, "radius", 0, dp(50))
.setDuration(400);
mRadiusAnimator
.setInterpolator(new AccelerateDecelerateInterpolator());
mRadiusAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
mRadiusAnimator.start();
if (!superResult) {
return true;
mRadiusAnimator.cancel();
mRadiusAnimator = ObjectAnimator.ofFloat(this, "radius", dp(50),
targetRadius);
mRadiusAnimator.setDuration(500);
mRadiusAnimator
.setInterpolator(new AccelerateDecelerateInterpolator());
mRadiusAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
mRadiusAnimator.start();
if (!superResult) {
return true;
代码示例来源:origin: zzz40500/android-shapeLoadingView
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mShapeLoadingView, "translationY", mDistance, 0);
ObjectAnimator scaleIndication = ObjectAnimator.ofFloat(mIndicationIm, "scaleX", 1f, 0.2f);
case SHAPE_RECT:
objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
代码示例来源:origin: chaychan/PowerfulViewLibrary
private void doArrowAnim() {
if (isExpand) {
// 当前是展开,将执行收起,箭头由上变为下
ObjectAnimator.ofFloat(ivArrow, "rotation", -180, 0).start();
} else {
// 当前是收起,将执行展开,箭头由下变为上
ObjectAnimator.ofFloat(ivArrow, "rotation", 0, 180).start();
}
}
代码示例来源:origin: myinnos/ImageSliderWithSwipes
/**
* When next item show in ViewPagerEx, let's make an animation to show the
* description layout.
* @param view
*/
@Override
public void onNextItemAppear(View view) {
View descriptionLayout = view.findViewById(R.id.description_layout);
if(descriptionLayout!=null){
float layoutY = ViewHelper.getY(descriptionLayout);
view.findViewById(R.id.description_layout).setVisibility(View.VISIBLE);
ValueAnimator animator = ObjectAnimator.ofFloat(
descriptionLayout,"y",layoutY + descriptionLayout.getHeight(),
layoutY).setDuration(500);
animator.start();
}
}
}
代码示例来源:origin: chiuki/advanced-textview
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animated_rainbow_span);
final TextView textView = (TextView) findViewById(R.id.text);
String text = textView.getText().toString();
AnimatedColorSpan span = new AnimatedColorSpan(this);
final SpannableString spannableString = new SpannableString(text);
String substring = getString(R.string.animated_rainbow_span).toLowerCase();
int start = text.toLowerCase().indexOf(substring);
int end = start + substring.length();
spannableString.setSpan(span, start, end, 0);
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
span, ANIMATED_COLOR_SPAN_FLOAT_PROPERTY, 0, 100);
objectAnimator.setEvaluator(new FloatEvaluator());
objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
textView.setText(spannableString);
}
});
objectAnimator.setInterpolator(new LinearInterpolator());
objectAnimator.setDuration(DateUtils.MINUTE_IN_MILLIS * 3);
objectAnimator.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator.start();
}
代码示例来源:origin: wangdan/AisenWeiBo
ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, CLIP_RADIUS,
startRadius, endRadius);
reveal.addListener(getRevealFinishListener(revealLayout));
代码示例来源:origin: vvinner/DragBottom
ObjectAnimator t=ObjectAnimator.ofInt(target,"backgroundColor",nowBgColor, Color.TRANSPARENT);
t.setEvaluator(ArgbEvaluator.getInstance());
t.start();
ObjectAnimator move=ObjectAnimator.ofFloat(target,"translationY",target.getTop(),target.getHeight());
move.setDuration(600);
if (animatorListenerAdapter != null) {
move.addListener(animatorListenerAdapter);
move.start();
ObjectAnimator.ofFloat(target,"alpha",1.0f,0f).start();
代码示例来源:origin: vinaygaba/CreditCardView
private void rotateInToBackBeforeEleven() {
com.nineoldandroids.animation.AnimatorSet set = new com.nineoldandroids.animation.AnimatorSet();
final com.nineoldandroids.animation.ObjectAnimator rotateIn = com.nineoldandroids.animation.ObjectAnimator.ofFloat(this, "rotationY", 0, 90);
final com.nineoldandroids.animation.ObjectAnimator hideFrontView = com.nineoldandroids.animation.ObjectAnimator.ofFloat(this, "alpha", 1, 0);
rotateIn.setInterpolator(new AccelerateDecelerateInterpolator());
rotateIn.setDuration(300);
hideFrontView.setDuration(1);
set.addListener(new com.nineoldandroids.animation.Animator.AnimatorListener() {
@Override
public void onAnimationStart(com.nineoldandroids.animation.Animator animation) {
}
@Override
public void onAnimationEnd(com.nineoldandroids.animation.Animator animation) {
rotateOutToBackBeforeEleven();
}
@Override
public void onAnimationCancel(com.nineoldandroids.animation.Animator animation) {
}
@Override
public void onAnimationRepeat(com.nineoldandroids.animation.Animator animation) {
}
});
set.play(hideFrontView).after(rotateIn);
set.start();
}
代码示例来源:origin: StannyBing/ZXUtils
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255);
bgAnim.setDuration(duration);
bgAnim.start();
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this,
"saturation", 0, 1);
colorizer.setDuration(duration);
colorizer.start();
代码示例来源:origin: Leaking/WeGit
private void initAnimations(int transformDuration, int pressedDuration) {
transformation = ObjectAnimator.ofFloat(this, transformationProperty, 0);
transformation.setInterpolator(new DecelerateInterpolator(3));
transformation.setDuration(transformDuration);
transformation.addListener(new AnimatorListenerAdapter() {
@Override public void onAnimationEnd(Animator animation) {
transformationRunning = false;
setIconState(animatingIconState);
}
});
pressedCircle = ObjectAnimator.ofFloat(this, pressedProgressProperty, 0, 0);
pressedCircle.setDuration(pressedDuration);
pressedCircle.setInterpolator(new DecelerateInterpolator());
pressedCircle.addListener(new AnimatorListenerAdapter() {
@Override public void onAnimationEnd(Animator animation) {
pressedProgressValue = 0;
}
@Override public void onAnimationCancel(Animator animation) {
pressedProgressValue = 0;
}
});
}
代码示例来源:origin: dom4j1/Red
ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(v.getBackground(), "cornerRadius", new float[]{0, v.getWidth() / 2});
cornerAnimation.setDuration(duration);
final ObjectAnimator heightAnimation = ObjectAnimator.ofInt(v, "xxx", new int[]{v.getHeight(), v.getWidth() / 2});
heightAnimation.setDuration(duration);
heightAnimation.addUpdateListener(new com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(com.nineoldandroids.animation.ValueAnimator valueAnimator) {
ObjectAnimator animator = ObjectAnimator.ofInt(v, "xx", v.getWidth(), v.getWidth() / 2).setDuration(duration);
animator.addUpdateListener(new ObjectAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(com.nineoldandroids.animation.ValueAnimator valueAnimator) {
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
代码示例来源:origin: posm/OpenMapKitAndroid
ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(this, propertiesList.toArray(new PropertyValuesHolder[0]));
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(zoomAndMove ? ANIMATION_DURATION_DEFAULT : ANIMATION_DURATION_SHORT);
anim.setTarget(mMapView);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
anim.addListener(listener);
anim.start();
return true;
代码示例来源:origin: SMSTicket/sms-ticket
if (secondImage == NO_ANIMATION) {
view.setImageResource(firstImage);
animator.end();
ViewCompat.setHasTransientState(view, false);
} else {
animator.setRepeatCount(ObjectAnimator.INFINITE);
animator.setDuration(1300);
animator.setInterpolator(new LinearInterpolator());
animator.setRepeatMode(ValueAnimator.RESTART);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
final Drawable shape1 = c.getResources().getDrawable(firstImage);
final Drawable shape2 = c.getResources().getDrawable(secondImage);
animator.start();
ViewCompat.setHasTransientState(view, true);
内容来源于网络,如有侵权,请联系作者删除!