当前位置: 首页>>代码示例>>Java>>正文


Java ValueAnimator.setInterpolator方法代码示例

本文整理汇总了Java中com.nineoldandroids.animation.ValueAnimator.setInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.setInterpolator方法的具体用法?Java ValueAnimator.setInterpolator怎么用?Java ValueAnimator.setInterpolator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.nineoldandroids.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.setInterpolator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Starts the underlying Animator for a set of properties. We use a single animator that
 * simply runs from 0 to 1, and then use that fractional value to set each property
 * value accordingly.
 */
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(1.0f);
    ArrayList<NameValuesHolder> nameValueList =
            (ArrayList<NameValuesHolder>) mPendingAnimations.clone();
    mPendingAnimations.clear();
    int propertyMask = 0;
    int propertyCount = nameValueList.size();
    for (int i = 0; i < propertyCount; ++i) {
        NameValuesHolder nameValuesHolder = nameValueList.get(i);
        propertyMask |= nameValuesHolder.mNameConstant;
    }
    mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(mAnimatorEventListener);
    animator.addListener(mAnimatorEventListener);
    if (mStartDelaySet) {
        animator.setStartDelay(mStartDelay);
    }
    if (mDurationSet) {
        animator.setDuration(mDuration);
    }
    if (mInterpolatorSet) {
        animator.setInterpolator(mInterpolator);
    }
    animator.start();
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:31,代码来源:ViewPropertyAnimatorHC.java

示例2: onTouchEvent

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_UP) {
        // 恢复高度
        final ValueAnimator animator = ValueAnimator.ofInt(parallaxImageView.getHeight(), originalHeight);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                Integer animateValue = (Integer) animator.getAnimatedValue();
                // 给 ImageView 设置值
                parallaxImageView.getLayoutParams().height = animateValue;
                parallaxImageView.requestLayout();
            }
        });
        animator.setInterpolator(new OvershootInterpolator()); // 弹性差值器
        animator.setDuration(450);
        animator.start();
    }
    return super.onTouchEvent(ev);
}
 
开发者ID:sleticalboy,项目名称:CustomWeight,代码行数:21,代码来源:ParallaxListView.java

示例3: startAnimation

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private void startAnimation() {
    ValueAnimator animator = ValueAnimator.ofFloat(new float[]{1.0f});
    ArrayList<NameValuesHolder> nameValueList = (ArrayList) this.mPendingAnimations.clone();
    this.mPendingAnimations.clear();
    int propertyMask = 0;
    for (int i = 0; i < nameValueList.size(); i++) {
        propertyMask |= ((NameValuesHolder) nameValueList.get(i)).mNameConstant;
    }
    this.mAnimatorMap.put(animator, new PropertyBundle(propertyMask, nameValueList));
    animator.addUpdateListener(this.mAnimatorEventListener);
    animator.addListener(this.mAnimatorEventListener);
    if (this.mStartDelaySet) {
        animator.setStartDelay(this.mStartDelay);
    }
    if (this.mDurationSet) {
        animator.setDuration(this.mDuration);
    }
    if (this.mInterpolatorSet) {
        animator.setInterpolator(this.mInterpolator);
    }
    animator.start();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:ViewPropertyAnimatorHC.java

示例4: animateCirlce

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Internal void to start the circles animation.
 * <p>
 * when this void is called the circles radius would be updated by a
 * {@link ValueAnimator} and then it will call the {@link View}'s
 * invalidate() void witch calls the onDraw void each time so a bigger
 * circle would be drawn each time till the cirlce's fill the whole screen.
 * </p>
 */
private void animateCirlce() {
	if (circles_fill_type == CIRLCES_FILL_HEIGHT_TYPE) {
		circle_max_radius = screen_height + (screen_height / 4);
	} else {
		circle_max_radius = screen_width + (screen_width / 4);
	}
	ValueAnimator va = ValueAnimator.ofInt(0, circle_max_radius / 3);
	va.setDuration(1000);
	va.addListener(this);
	va.setInterpolator(new AccelerateInterpolator());
	va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		public void onAnimationUpdate(ValueAnimator animation) {
			int value = (int) animation.getAnimatedValue();
			circle_radius = value * 3;
			invalidate();
		}
	});
	va.start();
}
 
开发者ID:Mahfa,项目名称:AndroidColorPop,代码行数:29,代码来源:PopBackgroundView.java

示例5: animateRect

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Internal void to start the rectangle animation.
 * <p>
 * when this void is called the space at the top of the rectangle would be
 * updated by a {@link ValueAnimator} and then it will call the {@link View}
 * 's invalidate() void witch calls the onDraw void each time so a bigger
 * rectangle would be drawn each time till the it the rectangles height is
 * enough
 * </p>
 */
private void animateRect() {
	ValueAnimator va = ValueAnimator.ofInt(rect_space_top / 2,
			screen_height / 2);
	va.setDuration(500);
	va.addListener(this);
	va.setInterpolator(new DecelerateInterpolator());
	va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
		public void onAnimationUpdate(ValueAnimator animation) {
			int value = ((int) animation.getAnimatedValue()) * 2;
			int rect_top = -((value - rect_space_top) - screen_height);
			rect.top = rect_top;
			invalidate();
		}
	});
	va.start();
}
 
开发者ID:Mahfa,项目名称:AndroidColorPop,代码行数:27,代码来源:PopBackgroundView.java

示例6: expandView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public void expandView(final View view) {
    ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {


            ViewHelper.setRotation(view,180 * (float) (animation.getAnimatedValue()));


            view.postInvalidate();
        }
    });
    animator.start();

}
 
开发者ID:canyinghao,项目名称:CanAdapter,代码行数:19,代码来源:ERVGridFragment.java

示例7: collapseView

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public void collapseView(final View view) {
    ValueAnimator animator = ValueAnimator.ofFloat(1, 0);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(200);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {



            ViewHelper.setRotation(view,180 * (float) (animation.getAnimatedValue()));

            view.postInvalidate();
        }
    });
    animator.start();

}
 
开发者ID:canyinghao,项目名称:CanAdapter,代码行数:19,代码来源:ERVGridFragment.java

示例8: moveTo

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public void moveTo(final float i, int duration) {
    int topMargin = getHeaderTopMargin();
    ValueAnimator animator = ValueAnimator.ofFloat(topMargin, i);
    animator.setDuration(duration);
    animator.setInterpolator(new DecelerateInterpolator());
    mPullStateE = PullStateE.PULL_STATE_NONE;
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {


        @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        public void onAnimationUpdate(ValueAnimator valueAnimator) {

            float temp = (Float) valueAnimator.getAnimatedValue();

            if (temp == i) {
                mPullStateE = PullStateE.PULL_STATE_NONE;
            }
            setHeaderTopMargin((int) temp);
        }
    });
    animator.start();
}
 
开发者ID:zzz40500,项目名称:Android-PullToNextLayout,代码行数:23,代码来源:PullToNextView.java

示例9: getWidthAnimator

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private Animator getWidthAnimator(final int from, final int to) {
  final ValueAnimator anim = ValueAnimator.ofInt(from, to);
  anim.addUpdateListener(new AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      final int val = (Integer)animation.getAnimatedValue();
      final ViewGroup.LayoutParams layoutParams = getLayoutParams();
      layoutParams.width = val;
      setLayoutParams(layoutParams);
    }
  });
  anim.setInterpolator(new FastOutSlowInInterpolator());
  anim.setDuration(TRANSITION_MS);
  return anim;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:TransferControlView.java

示例10: restoreStepperContent

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 中间滑条恢复原位置
 */
private void restoreStepperContent() {
    if (animationing) return;
    animationing = true;
    ValueAnimator restoreTranslateAnimation = ValueAnimator.ofFloat(tvStepperContent.getLeft(), (int) startStepperContentLeft);
    restoreTranslateAnimation.setDuration(ANIMATIONDURATION);
    restoreTranslateAnimation.addListener(this);
    restoreTranslateAnimation.addUpdateListener(this);
    restoreTranslateAnimation.setInterpolator(new AccelerateInterpolator());
    restoreTranslateAnimation.start();
}
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:14,代码来源:SnappingStepper.java

示例11: setProgress

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
/**
     * 设置进度,此为线程安全控件,由于考虑多线的问题,需要同步 刷新界面调用postInvalidate()能在非UI线程刷新
     *
     * @param progress
     */

    public synchronized void setProgress(int progress) {
        if (this.progress == progress) {
            return;
        }

//        hasShowing = true;
        if (progress < 0) {
//			throw new IllegalArgumentException("progress not less than 0");
            return;
        }
        if (progress > max) {
            progress = max;
        }
        ValueAnimator va = ValueAnimator.ofInt(this.progress, progress);
        va.setDuration(1000);
        va.setInterpolator(new AccelerateInterpolator());
        va.start();
        va.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator arg0) {
                int value = (Integer) arg0.getAnimatedValue();
                if (value <= max) {
                    RoundProgressBar.this.progress = value;
                    invalidate();
                }
            }
        });

    }
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:36,代码来源:RoundProgressBar.java

示例12: a

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private void a()
{
    ValueAnimator valueanimator = ValueAnimator.ofFloat(new float[] {
        1.0F
    });
    ArrayList arraylist = (ArrayList)a.clone();
    a.clear();
    int i1 = arraylist.size();
    int j1 = 0;
    int k1 = 0;
    do
    {
        if (j1 >= i1)
        {
            y.put(valueanimator, new m(k1, arraylist));
            valueanimator.addUpdateListener(k);
            valueanimator.addListener(k);
            if (g)
            {
                valueanimator.setStartDelay(f);
            }
            if (e)
            {
                valueanimator.setDuration(d);
            }
            if (i)
            {
                valueanimator.setInterpolator(h);
            }
            valueanimator.start();
            return;
        }
        k1 |= ((l)arraylist.get(j1)).a;
        j1++;
    } while (true);
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:37,代码来源:i.java

示例13: a

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
private void a()
{
    ValueAnimator valueanimator = ValueAnimator.ofFloat(new float[] {
        1.0F
    });
    ArrayList arraylist = (ArrayList)a.clone();
    a.clear();
    int i1 = arraylist.size();
    int j1 = 0;
    int k1 = 0;
    do
    {
        if (j1 >= i1)
        {
            x.put(valueanimator, new f(k1, arraylist));
            valueanimator.addUpdateListener(j);
            valueanimator.addListener(j);
            if (f)
            {
                valueanimator.setStartDelay(e);
            }
            if (d)
            {
                valueanimator.setDuration(c);
            }
            if (h)
            {
                valueanimator.setInterpolator(g);
            }
            valueanimator.start();
            return;
        }
        k1 |= ((e)arraylist.get(j1)).a;
        j1++;
    } while (true);
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:37,代码来源:b.java

示例14: onTouchEvent

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() != MotionEvent.ACTION_DOWN &&
            event.getAction() != MotionEvent.ACTION_MOVE) {
        return false;
    }
    ShapeHolder newBall = addBall(event.getX(), event.getY());

    // Bouncing animation with squash and stretch
    float startY = newBall.getY();
    float endY = getHeight() - 50f;
    float h = (float)getHeight();
    float eventY = event.getY();
    int duration = (int)(500 * ((h - eventY)/h));
    ValueAnimator bounceAnim = ObjectAnimator.ofFloat(newBall, "y", startY, endY);
    bounceAnim.setDuration(duration);
    bounceAnim.setInterpolator(new AccelerateInterpolator());
    ValueAnimator squashAnim1 = ObjectAnimator.ofFloat(newBall, "x", newBall.getX(),
            newBall.getX() - 25f);
    squashAnim1.setDuration(duration/4);
    squashAnim1.setRepeatCount(1);
    squashAnim1.setRepeatMode(ValueAnimator.REVERSE);
    squashAnim1.setInterpolator(new DecelerateInterpolator());
    ValueAnimator squashAnim2 = ObjectAnimator.ofFloat(newBall, "width", newBall.getWidth(),
            newBall.getWidth() + 50);
    squashAnim2.setDuration(duration/4);
    squashAnim2.setRepeatCount(1);
    squashAnim2.setRepeatMode(ValueAnimator.REVERSE);
    squashAnim2.setInterpolator(new DecelerateInterpolator());
    ValueAnimator stretchAnim1 = ObjectAnimator.ofFloat(newBall, "y", endY,
            endY + 25f);
    stretchAnim1.setDuration(duration/4);
    stretchAnim1.setRepeatCount(1);
    stretchAnim1.setInterpolator(new DecelerateInterpolator());
    stretchAnim1.setRepeatMode(ValueAnimator.REVERSE);
    ValueAnimator stretchAnim2 = ObjectAnimator.ofFloat(newBall, "height",
            newBall.getHeight(), newBall.getHeight() - 25);
    stretchAnim2.setDuration(duration/4);
    stretchAnim2.setRepeatCount(1);
    stretchAnim2.setInterpolator(new DecelerateInterpolator());
    stretchAnim2.setRepeatMode(ValueAnimator.REVERSE);
    ValueAnimator bounceBackAnim = ObjectAnimator.ofFloat(newBall, "y", endY,
            startY);
    bounceBackAnim.setDuration(duration);
    bounceBackAnim.setInterpolator(new DecelerateInterpolator());
    // Sequence the down/squash&stretch/up animations
    AnimatorSet bouncer = new AnimatorSet();
    bouncer.play(bounceAnim).before(squashAnim1);
    bouncer.play(squashAnim1).with(squashAnim2);
    bouncer.play(squashAnim1).with(stretchAnim1);
    bouncer.play(squashAnim1).with(stretchAnim2);
    bouncer.play(bounceBackAnim).after(stretchAnim2);

    // Fading animation - remove the ball when the animation is done
    ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
    fadeAnim.setDuration(250);
    fadeAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            balls.remove(((ObjectAnimator)animation).getTarget());

        }
    });

    // Sequence the two animations to play one after the other
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(bouncer).before(fadeAnim);

    // Start the animation
    animatorSet.start();

    return true;
}
 
开发者ID:515445681,项目名称:NineOldAndroids-master,代码行数:74,代码来源:BouncingBalls.java

示例15: queue

import com.nineoldandroids.animation.ValueAnimator; //导入方法依赖的package包/类
public void queue(Attributes attrs) {
    final ValueAnimator animator = ObjectAnimator.ofFloat(mView, mPropertyName, attrs.value);
    animator.setDuration(attrs.durationMs);
    animator.setInterpolator(new AccelerateInterpolator());
    animatorChain.add(animator);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:7,代码来源:BounceAnimatorBuilder.java


注:本文中的com.nineoldandroids.animation.ValueAnimator.setInterpolator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。