首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何用ObjectAnimator旋转一个可绘制的图形?

如何用ObjectAnimator旋转一个可绘制的图形?
EN

Stack Overflow用户
提问于 2012-12-26 18:28:24
回答 1查看 36.2K关注 0票数 22

把一个可绘制的作品写成字母就像这样:

代码语言:javascript
复制
if(mAlphaAnimation == null){
        mAlphaAnimation = ObjectAnimator.ofFloat(this, "alpha", 0.0f,1.0f).setDuration(TARGET_ANIM_ALPHA_DURATION);
        mAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        mAlphaAnimation.setStartDelay(TARGET_ANIM_ALPHA_DELAY_BASE*power);
        mAlphaAnimation.setRepeatCount(ValueAnimator.INFINITE);
        mAlphaAnimation.setRepeatMode(ValueAnimator.REVERSE);
        mAlphaAnimation.addUpdateListener(this);
 }

但如果我想像下面这样旋转一个可绘制的,它就不起作用了。

代码语言:javascript
复制
private void createRotateAnim(float fromDegress,float toDegress,int duration){
    if(mRotateAnimation == null){
        mRotateAnimation = ObjectAnimator.ofFloat(this, "rotation",fromDegress,toDegress).setDuration(duration);
        mRotateAnimation.setStartDelay(100);
        mRotateAnimation.setInterpolator(new AccelerateInterpolator());
        mRotateAnimation.addUpdateListener(this);
    }
}

任何人都可以帮助我解决这个问题,或者这些是创建旋转可绘制动画的任何其他方式。

我为我糟糕的英语感到抱歉。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14039265

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档