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


Java ValueAnimator.setTarget方法代码示例

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


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

示例1: getBezierValueAnimator

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private ValueAnimator getBezierValueAnimator(LeafHolder target, RectF leafFlyRect, float progress) {
    BezierEvaluator evaluator = new BezierEvaluator(getPoint1(leafFlyRect), getPoint2(leafFlyRect));

    int leafFlyStartY = (int) (mCurrentProgressBounds.bottom - mLeafDrawable.getIntrinsicHeight());
    int leafFlyRange = (int) (mCurrentProgressBounds.height() - mLeafDrawable.getIntrinsicHeight());

    int startPointY = leafFlyStartY - mRandom.nextInt(leafFlyRange);
    int endPointY = leafFlyStartY - mRandom.nextInt(leafFlyRange);

    ValueAnimator animator = ValueAnimator.ofObject(evaluator,
            new PointF((int) (leafFlyRect.right - mLeafDrawable.getIntrinsicWidth()), startPointY),
            new PointF(leafFlyRect.left, endPointY));
    animator.addUpdateListener(new BezierListener(target));
    animator.setTarget(target);

    animator.setDuration((long) ((mRandom.nextInt(300) + mDuration * DEFAULT_LEAF_FLY_DURATION_FACTOR) * (1.0f - progress)));

    return animator;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ElectricFanLoadingRenderer.java

示例2: setFooterViewInvisibleWithAnim

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 没有更多内容时,采用动画设置底部View消失
 */
public void setFooterViewInvisibleWithAnim() {
    footerBar.setVisibility(View.GONE);
    footerViewHeight = footerLayout.getMeasuredHeight();
    ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100);
    valueAnimator.setTarget(footerLayout);
    valueAnimator.setDuration(500);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float i = Float.valueOf(String.valueOf(animation.getAnimatedValue()));
            footerLayout.setPadding(0, 0, 0, -(int) (i / 100 * footerViewHeight));
        }
    });
    valueAnimator.start();
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:19,代码来源:RefreshListView.java

示例3: setStateRefreshing

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void setStateRefreshing() {
    ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100);
    valueAnimator.setTarget(headView);
    valueAnimator.setDuration(500);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float i = Float.valueOf(String.valueOf(animation.getAnimatedValue()));
            headView.setPadding(0, (int) ((i / 100 * headContentHeight) - headContentHeight), 0, 0);
        }
    });
    valueAnimator.start();
    progressBar.setVisibility(View.VISIBLE);
    arrowImageView.clearAnimation();
    arrowImageView.setVisibility(View.GONE);
    tipsTextview.setText(getContext().getString(R.string.kf5_updating));
    lastUpdatedTextView.setVisibility(View.VISIBLE);

}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:20,代码来源:RefreshListView.java

示例4: getBezierAnimtor

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * 爱心运动轨迹的动画实现
 */
private ValueAnimator getBezierAnimtor(final View target) {

  BezierEvaluator evaluator = new BezierEvaluator(getPoint(2), getPoint(1));

  ValueAnimator animator = ValueAnimator.ofObject(evaluator,
      new PointF((measuredWidth - drawableWidth) / 2, measuredHeight - drawableHeight),
      new PointF(mRandom.nextInt(getWidth()), 0));

  animator.setDuration(3000);
  animator.setTarget(target);
  animator.addUpdateListener(valueAnimator -> {
    //获取贝塞尔曲线的运动轨迹 让爱心跟随着移动
    PointF animatedValue = (PointF) valueAnimator.getAnimatedValue();
    target.setX(animatedValue.x);
    target.setY(animatedValue.y);
    //增加透明度的变化
    target.setAlpha(1 - valueAnimator.getAnimatedFraction());
  });

  return animator;
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:25,代码来源:LoveLikeLayout.java

示例5: getBezierAnimator

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/** 爱心轨迹动画实现 */
private ValueAnimator getBezierAnimator(View view) {
    BezierEvaluator bezierEvaluator = new BezierEvaluator(getPoint(2), getPoint(1));
    ValueAnimator animator = ValueAnimator.ofObject(bezierEvaluator,
            new PointF((mMeasuredWidth - mDrawableWidth) / 2, mMeasuredHeight - mDrawableHeight),
            new PointF(mRandom.nextInt(getWidth()), 0));
    animator.setDuration(3000);
    animator.setTarget(view);
    animator.addUpdateListener(valueAnimator -> {
        // 获取贝塞尔曲线运动轨迹
        PointF animatedValue = (PointF) valueAnimator.getAnimatedValue();
        view.setScaleX(animatedValue.x);
        view.setScaleY(animatedValue.y);
        view.setAlpha(1 - valueAnimator.getAnimatedFraction());
    });
    return animator;
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:18,代码来源:LoveLikeLayout.java

示例6: getBezierValueAnimator

import android.animation.ValueAnimator; //导入方法依赖的package包/类
private ValueAnimator getBezierValueAnimator(View target) {

        //初始化一个贝塞尔计算器- - 传入
        BezierEvaluator evaluator = new BezierEvaluator(getPointF(2), getPointF(1));

        //这里最好画个图 理解一下 传入了起点 和 终点
        ValueAnimator animator = ValueAnimator.ofObject(evaluator, new PointF(startX, mHeight - dHeight), new PointF(random.nextInt(getWidth()), 0));
        animator.addUpdateListener(new BezierListener(target));
        animator.setTarget(target);
        animator.setDuration(3000);
        return animator;
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:13,代码来源:PeriscopeLayout.java


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