當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。