當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectAnimator.ofObject方法代碼示例

本文整理匯總了Java中android.animation.ObjectAnimator.ofObject方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectAnimator.ofObject方法的具體用法?Java ObjectAnimator.ofObject怎麽用?Java ObjectAnimator.ofObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.ObjectAnimator的用法示例。


在下文中一共展示了ObjectAnimator.ofObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onDrawState

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
@Override
public void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
    canvas.drawText(title,
            (rv.getMeasuredWidth() >> 1),
            (rv.getMeasuredHeight() >> 1),
            textPaint);

    // Setup animator, if necessary
    if (anim == null) {
        this.anim = ObjectAnimator.ofObject(textPaint, "color", new ArgbEvaluator(),
                Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
        this.anim.setDuration(900);
        this.anim.setRepeatMode(ValueAnimator.REVERSE);
        this.anim.setRepeatCount(ValueAnimator.INFINITE);
        this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                rv.invalidate();
            }
        });
        this.anim.start();
    }
}
 
開發者ID:tylersuehr7,項目名稱:empty-state-recyclerview,代碼行數:24,代碼來源:DefaultLoadingState.java

示例2: onDrawState

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
@Override
public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) {
    final int width = rv.getMeasuredWidth();
    final int height = rv.getMeasuredHeight();

    // Draw all of our content items
    renderContent(numberOfContentItems, width, height, canvas, contentPaint);

    // Setup and start animation, if possible
    if (animateContentItems) {
        if (anim == null) {
            this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(),
                    Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E"));
            onInterceptAnimatorCreation(anim);
            this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    rv.invalidate();
                }
            });
            this.anim.start();
        }
    }
}
 
開發者ID:tylersuehr7,項目名稱:empty-state-recyclerview,代碼行數:25,代碼來源:ContentItemLoadingStateFactory.java

示例3: startAnim

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * 給背景設置一個動畫
 *
 * @param endProgress 動畫的結束進度
 * @param endCallback 動畫結束時觸發
 */
private void startAnim(float endProgress, final Runnable endCallback) {
    // 獲取一個最終的顏色
    int finalColor = Resource.Color.WHITE; // UiCompat.getColor(getResources(), R.color.white);
    // 運算當前進度的顏色
    ArgbEvaluator evaluator = new ArgbEvaluator();
    int endColor = (int) evaluator.evaluate(endProgress, mBgDrawable.getColor(), finalColor);
    // 構建一個屬性動畫
    ValueAnimator valueAnimator = ObjectAnimator.ofObject(this, property, evaluator, endColor);
    valueAnimator.setDuration(1500); // 時間
    valueAnimator.setIntValues(mBgDrawable.getColor(), endColor); // 開始結束值
    valueAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            // 結束時觸發
            endCallback.run();
        }
    });
    valueAnimator.start();
}
 
開發者ID:FZZFVII,項目名稱:pipe,代碼行數:27,代碼來源:LaunchActivity.java

示例4: animateCheckedState

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
@SuppressLint("ObsoleteSdkInt")
private void animateCheckedState(boolean newCheckedState) {
    AnimatorProperty property = new AnimatorProperty();
    if (newCheckedState) {
        property.color = onColor;
        property.offLineWidth = 10;
        property.spotX = spotMaxX;
    } else {
        property.color = offBorderColor;
        property.offLineWidth = spotSize;
        property.spotX = spotMinX;
    }

    if (mAnimator == null) {
        mAnimator = ObjectAnimator.ofObject(this, ANIM_VALUE, new AnimatorEvaluator(mCurProperty), property);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
            mAnimator.setAutoCancel(true);
        mAnimator.setDuration(ANIMATION_DURATION);
        mAnimator.setInterpolator(ANIMATION_INTERPOLATOR);
    } else {
        mAnimator.cancel();
        mAnimator.setObjectValues(property);
    }
    mAnimator.start();
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:26,代碼來源:ToggleButton.java

示例5: openMenu

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * Call this function to open menu.
 */
private void openMenu() {

    ObjectAnimator animator = ObjectAnimator.ofObject(this, "path", new CirclePathEvaluator(circlePathRadius, viewCircleCenterX, viewCircleCenterY, CirclePathEvaluator.OPEN, isClockwise), startPathPoints, endPathPoints);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(period);
    animator.start();
    //menuOpening = true;
    menuStatus = OPENING;
    if (onMenuSwitchListener != null) {
        onMenuSwitchListener.onMenuSwitch(OPENING, currentIndex);
    }
}
 
開發者ID:qinwenbo114,項目名稱:CircleMenu,代碼行數:16,代碼來源:CircleMenu.java

示例6: closeMenu

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * Call this function to close menu.
 */
private void closeMenu() {

    ObjectAnimator animator = ObjectAnimator.ofObject(this, "path", new CirclePathEvaluator(circlePathRadius, viewCircleCenterX, viewCircleCenterY, CirclePathEvaluator.CLOSE, isClockwise), startPathPoints, endPathPoints);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.setDuration(period);
    animator.start();
    //menuOpening = false;
    menuStatus = CLOSING;
    if (onMenuSwitchListener != null) {
        onMenuSwitchListener.onMenuSwitch(CLOSING, currentIndex);
    }
}
 
開發者ID:qinwenbo114,項目名稱:CircleMenu,代碼行數:16,代碼來源:CircleMenu.java

示例7: ActionModeCallback

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public ActionModeCallback(Activity activity, ActionListener listener) {
    context = activity;
    window = activity.getWindow();
    actionListener = listener;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        statusBarColor = window.getStatusBarColor();
        int actionModeStatusBarColor = ContextCompat.getColor(context,
                R.color.mp_theme_dark_blue_actionMode_statusBarColor);
        int startColor = Color.argb(
                0,
                Color.red(actionModeStatusBarColor),
                Color.green(actionModeStatusBarColor),
                Color.blue(actionModeStatusBarColor)
        );
        actionModeInAnimator = ObjectAnimator.ofObject(
                window,
                STATUS_BAR_COLOR,
                new ArgbEvaluator(),
                startColor,
                actionModeStatusBarColor
        );
        actionModeOutAnimator = ObjectAnimator.ofObject(
                window,
                STATUS_BAR_COLOR,
                new ArgbEvaluator(),
                actionModeStatusBarColor,
                startColor
        );
        actionModeInAnimator.setDuration(ANIMATION_DURATION);
        actionModeOutAnimator.setDuration(ANIMATION_DURATION);
    }
}
 
開發者ID:xxczaki,項目名稱:music-player,代碼行數:33,代碼來源:ActionModeCallback.java

示例8: performColorSwapAnimation

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public static void performColorSwapAnimation(FullscreenBaseGameActivity context, Integer[] shuffle, List<Button> buttons, FrameLayout[] layouts) {
    for (int i = 0; i < buttons.size(); i++) {
        int index = shuffle[i];
        layouts[i].addView(buttons.get(index));
        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(buttons.get(i), "backgroundColor",
                new ArgbEvaluator(),
                ContextCompat.getColor(context, SimonColorImpl.getColorIdFromButtonId(buttons.get(index).getId())),
                ContextCompat.getColor(context, SimonColorImpl.getColorIdFromButtonId(buttons.get(i).getId())));
        objectAnimator.setRepeatCount(0);
        objectAnimator.setRepeatMode(ValueAnimator.REVERSE);
        objectAnimator.setDuration(300);
        objectAnimator.start();
    }
}
 
開發者ID:simoneapp,項目名稱:S3-16-simone,代碼行數:15,代碼來源:AnimationHandler.java

示例9: LQRRefreshButton

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public LQRRefreshButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    // 獲取自定義屬性值
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.LQRRefreshButton);
    borderColor = ta.getColor(R.styleable.LQRRefreshButton_refresh_btn_borderColor, Color.parseColor("#fb7299"));
    borderWidth = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_borderWidth, dipToPx(0));
    borderRadius = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_borderRadius, dipToPx(60));
    text = ta.getString(R.styleable.LQRRefreshButton_refresh_btn_text);
    if (text == null)
        text = "";
    textColor = ta.getColor(R.styleable.LQRRefreshButton_refresh_btn_textColor, Color.parseColor("#fb7299"));
    textSize = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_textSize, spToPx(14));
    iconSrc = ta.getResourceId(R.styleable.LQRRefreshButton_refresh_btn_iconSrc, R.mipmap.tag_center_refresh_icon);
    iconSize = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_iconSize, dipToPx(14));
    space4TextAndIcon = ta.getDimension(R.styleable.LQRRefreshButton_refresh_btn_space4TextAndIcon, dipToPx(10));

    ta.recycle();

    // icon
    iconBitmap = BitmapFactory.decodeResource(getResources(), iconSrc);
    iconBitmap = zoomImg(iconBitmap, iconSize, iconSize);

    // 旋轉動畫
    mAnimator = ObjectAnimator.ofObject(this, "degress", new FloatEvaluator(), 360, 0);
    mAnimator.setDuration(2000);
    mAnimator.setRepeatMode(ObjectAnimator.RESTART);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setRepeatCount(ObjectAnimator.INFINITE);
}
 
開發者ID:GitLqr,項目名稱:LQRBiliBlili,代碼行數:31,代碼來源:LQRRefreshButton.java

示例10: animate

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public ObjectAnimator animate(int start, int end) {
    float[][] startPoints = NumberUtils.getControlPointsFor(start);
    float[][] endPoints = NumberUtils.getControlPointsFor(end);

    return ObjectAnimator.ofObject(this, CONTROL_POINTS_PROPERTY, new TimelyEvaluator(), startPoints, endPoints);
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:7,代碼來源:TimelyView.java

示例11: fadeColoTo

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void fadeColoTo(int newColor, TextView view)
{
       ObjectAnimator color = ObjectAnimator.ofObject(view, "TextColor", new ArgbEvaluator(), view.getCurrentTextColor(), newColor);
       color.setDuration(200);
       color.start();
   }
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:7,代碼來源:MainActivity.java

示例12: ofColor

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public static ObjectAnimator ofColor(Object target, String propertyName, int from, int to) {
	return ObjectAnimator.ofObject(target, propertyName, new ColorEvaluator(), from, to);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:4,代碼來源:ColorAnimator.java

示例13: ofBackgroundColor

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public static ObjectAnimator ofBackgroundColor(View target, int from, int to) {
	return ObjectAnimator.ofObject(new ViewBackgroundWrapper(target), "backgroundColor", new ColorEvaluator(), from, to);
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:4,代碼來源:ColorAnimator.java

示例14: fadeColoTo

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void fadeColoTo(int newColor, TextView view) {

        ObjectAnimator color = ObjectAnimator.ofObject(view, "TextColor", new ArgbEvaluator(), view.getCurrentTextColor(), newColor);
        color.setDuration(200);
        color.start();
    }
 
開發者ID:florent37,項目名稱:Depth,代碼行數:7,代碼來源:RootActivity.java

示例15: toAlphaOne

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public static ObjectAnimator toAlphaOne(View view, int duration) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, "alpha", new FloatEvaluator(), 0.0f, 1.0f);
    objectAnimator.setDuration(duration);
    return objectAnimator;
}
 
開發者ID:panshen,項目名稱:PopupCircleMenu,代碼行數:6,代碼來源:AnimUtil.java


注:本文中的android.animation.ObjectAnimator.ofObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。