Search in sources :

Example 96 with RotateAnimation

use of android.view.animation.RotateAnimation in project Android-Bootstrap by Bearded-Hen.

the class AwesomeTextView method startRotate.

/**
 * Starts a rotating animation on the AwesomeTextView
 *
 * @param clockwise true for clockwise, false for anti clockwise spinning
 * @param speed     how fast the item should rotate
 */
public void startRotate(boolean clockwise, AnimationSpeed speed) {
    Animation rotate;
    // set up the rotation animation
    if (clockwise) {
        rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    } else {
        rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    }
    // set up some extra variables
    rotate.setRepeatCount(Animation.INFINITE);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setStartOffset(0);
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setDuration(speed.getRotateDuration());
    startAnimation(rotate);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) RotateAnimation(android.view.animation.RotateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation)

Example 97 with RotateAnimation

use of android.view.animation.RotateAnimation in project AgileDev by LZ9.

the class AnimUtils method startRotateSelf.

/**
 * 旋转自身
 * @param view 控件
 * @param fromDegrees 起始角度
 * @param toDegrees 结束角度
 * @param duration 时间
 * @param fillAfter 动画转化结束后被应用
 */
public static void startRotateSelf(View view, float fromDegrees, float toDegrees, long duration, boolean fillAfter) {
    view.clearAnimation();
    Animation animation = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(duration);
    // 设置为true,动画转化结束后被应用
    animation.setFillAfter(fillAfter);
    // 开始动画
    view.startAnimation(animation);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation)

Example 98 with RotateAnimation

use of android.view.animation.RotateAnimation in project incubator-weex by apache.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    View textView = findViewById(R.id.fullscreen_content);
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(scaleAnimation);
    animationSet.addAnimation(rotateAnimation);
    animationSet.setDuration(1500);
    animationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            startActivity(new Intent(SplashActivity.this, IndexActivity.class));
            finish();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    textView.startAnimation(animationSet);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) Intent(android.content.Intent) View(android.view.View) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 99 with RotateAnimation

use of android.view.animation.RotateAnimation in project BaseProject by wareine.

the class JxbRefreshFooter method initView.

private void initView(Context context) {
    this.setGravity(Gravity.CENTER);
    this.setOrientation(LinearLayout.HORIZONTAL);
    mTitleText = new TextView(context);
    mTitleText.setText(REFRESH_FOOTER_PULLUP);
    mTitleText.setTextColor(0xff8b8b8b);
    mTitleText.setTextSize(12);
    LayoutParams lpProgress = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    mProgressView = new ImageView(context);
    mProgressView.setImageResource(R.drawable.default_ptr_rotate);
    addView(mProgressView, lpProgress);
    LayoutParams lpHeaderText = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    lpHeaderText.leftMargin = DensityUtil.dp2px(10);
    addView(mTitleText, lpHeaderText);
    setMinimumHeight(DensityUtil.dp2px(40));
    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 100 with RotateAnimation

use of android.view.animation.RotateAnimation in project BaseProject by wareine.

the class PtrJxbHeader method initView.

private void initView(Context context) {
    this.setGravity(Gravity.CENTER);
    this.setOrientation(LinearLayout.VERTICAL);
    mTitleText = new TextView(context);
    mTitleText.setText(REFRESH_HEADER_PULLDOWN);
    mTitleText.setTextColor(0xff8b8b8b);
    mTitleText.setTextSize(13);
    LayoutParams lpProgress = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    mProgressView = new ImageView(context);
    mProgressView.setImageResource(R.drawable.default_ptr_rotate);
    addView(mProgressView, lpProgress);
    LayoutParams lpHeaderText = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    lpHeaderText.topMargin = DisplayUtil.dp2px(context, 5);
    addView(mTitleText, lpHeaderText);
    setPadding(0, DisplayUtil.dp2px(context, 10), 0, DisplayUtil.dp2px(context, 18));
    setMinimumHeight(DisplayUtil.dp2px(context, 60));
    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Aggregations

RotateAnimation (android.view.animation.RotateAnimation)117 LinearInterpolator (android.view.animation.LinearInterpolator)39 Animation (android.view.animation.Animation)30 AnimationSet (android.view.animation.AnimationSet)24 ImageView (android.widget.ImageView)18 ScaleAnimation (android.view.animation.ScaleAnimation)17 View (android.view.View)16 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)16 TextView (android.widget.TextView)16 AlphaAnimation (android.view.animation.AlphaAnimation)13 TranslateAnimation (android.view.animation.TranslateAnimation)9 Context (android.content.Context)5 LinearLayout (android.widget.LinearLayout)5 SuppressLint (android.annotation.SuppressLint)4 Intent (android.content.Intent)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 IOException (java.io.IOException)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3 RecyclerView (android.support.v7.widget.RecyclerView)3