当前位置: 首页>>代码示例>>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;未经允许,请勿转载。