android.view.animation.AccelerateDecelerateInterpolator Java Examples

The following examples show how to use android.view.animation.AccelerateDecelerateInterpolator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnimationService.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
public static void setActivityToolbarCircularRevealAnimation(final Toolbar aDecorativeToolbar) {
    aDecorativeToolbar.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            v.removeOnLayoutChangeListener(this);

            int CIRCULAR_REVEAL_DURATION = 700;
            int cx = (aDecorativeToolbar.getLeft() + aDecorativeToolbar.getRight()) / 2;
            int cy = 0;

            // get the final radius for the clipping circle
            int finalRadius = Math.max(aDecorativeToolbar.getWidth(), aDecorativeToolbar.getHeight());

            SupportAnimator animator = ViewAnimationUtils.createCircularReveal(aDecorativeToolbar, cx, cy, 0, finalRadius);

            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(CIRCULAR_REVEAL_DURATION);
            animator.start();
        }
    });
}
 
Example #2
Source File: BezierPraiseAnimator.java    From kAndroid with Apache License 2.0 6 votes vote down vote up
/**
 * 获取到点赞小图标动画
 *
 * @param target
 * @return
 */
private Animator getPraiseAnimator(View target) {
    // 获取贝塞尔曲线动画
    ValueAnimator bezierPraiseAnimator = getBezierPraiseAnimator(target);
    // 组合动画(旋转动画+贝塞尔曲线动画)旋转角度(200~720)
    int rotationAngle = mRandom.nextInt(520) + 200;
    ObjectAnimator rotationAnimator = ObjectAnimator.ofFloat(target, "rotation", 0,
            rotationAngle % 2 == 0 ? rotationAngle : -rotationAngle);
    rotationAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    rotationAnimator.setTarget(target);

    // 组合动画
    AnimatorSet composeAnimator = new AnimatorSet();
    composeAnimator.play(bezierPraiseAnimator).with(rotationAnimator);
    composeAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    composeAnimator.setDuration(mAnimatorDuration);
    composeAnimator.setTarget(target);
    return composeAnimator;

}
 
Example #3
Source File: AnimationService.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
public static void setActivityToolbarReset(Toolbar aMainToolbar, Toolbar aDecorativeToolbar, Activity aActivity, float fromToolbarPosition, float fromMainToolbarPosition) {
    final int TOOLBAR_TRANSLATION_DURATION = 700;
    float DECORATIVE_TOOLBAR_HEIGHT = -1 * aActivity.getResources().getDimension(R.dimen.additional_toolbar_height);
    if (fromMainToolbarPosition == 0) {
        DECORATIVE_TOOLBAR_HEIGHT += aActivity.getResources().getDimension(R.dimen.main_toolbar_height);
    } else {
        Animation moveMainToolbarAnimation = new TranslateAnimation(0, 0, fromMainToolbarPosition, 0);
        moveMainToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        moveMainToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);

        aMainToolbar.startAnimation(moveMainToolbarAnimation);
    }
    float fromTranslationY = Math.max(fromToolbarPosition, DECORATIVE_TOOLBAR_HEIGHT);

    Animation moveToolbarAnimation = new TranslateAnimation(0, 0, fromTranslationY, 0);
    moveToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    moveToolbarAnimation.setDuration(TOOLBAR_TRANSLATION_DURATION);

    aDecorativeToolbar.startAnimation(moveToolbarAnimation);
}
 
Example #4
Source File: BezierMoveView.java    From BezierView with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    ValueAnimator valueAnimator = ValueAnimator.ofObject(new CirclePointEvaluator(), new Point(mStartXPoint, mStartYPoint),
            new Point(mEndXPoint, mEndYPoint));
    valueAnimator.setDuration(600);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Point point = (Point) animation.getAnimatedValue();
            mMoveXPoint = point.x;
            mMoveYPoint = point.y;
            invalidate();
        }
    });
    valueAnimator.start();

}
 
Example #5
Source File: AnimationService.java    From Twire with GNU General Public License v3.0 6 votes vote down vote up
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
    final int ANIMATION_DURATION = 650;
    final int BASE_DELAY = 50;

    TranslateAnimation translationAnimation = new TranslateAnimation(0, 0, height, 0);

    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);

    final AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(translationAnimation);
    animationSet.addAnimation(alphaAnimation);
    animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animationSet.setFillAfter(true);
    animationSet.setFillBefore(true);
    animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);

    aCard.setAnimation(animationSet);
}
 
Example #6
Source File: HorizontalProgressView.java    From ProgressView with Apache License 2.0 6 votes vote down vote up
/**
 * @param startProgress 起始进度
 * @param progress 进度值
 * @param duration 动画播放时间
 */
public void setProgressInTime(int startProgress, final int progress, final long duration) {
  ValueAnimator valueAnimator = ValueAnimator.ofInt(startProgress, progress);
  valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

    @Override
    public void onAnimationUpdate(ValueAnimator animator) {
      //获得当前动画的进度值,整型,1-100之间
      int currentValue = (Integer) animator.getAnimatedValue();
      setProgress(currentValue);
    }
  });
  AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
  valueAnimator.setInterpolator(interpolator);
  valueAnimator.setDuration(duration);
  valueAnimator.start();
}
 
Example #7
Source File: LoginActivity.java    From AndroidProject with Apache License 2.0 6 votes vote down vote up
@Override
public void onSoftKeyboardClosed() {
    // 执行位移动画
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBodyLayout, "translationY", mBodyLayout.getTranslationY(), 0);
    objectAnimator.setDuration(mAnimTime);
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.start();

    if (mLogoView.getTranslationY() == 0){
        return;
    }
    // 执行放大动画
    mLogoView.setPivotX(mLogoView.getWidth() / 2f);
    mLogoView.setPivotY(mLogoView.getHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(mLogoView, "scaleX", mLogoScale, 1.0f);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(mLogoView, "scaleY", mLogoScale, 1.0f);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(mLogoView, "translationY", mLogoView.getTranslationY(), 0);
    animatorSet.play(translationY).with(scaleX).with(scaleY);
    animatorSet.setDuration(mAnimTime);
    animatorSet.start();
}
 
Example #8
Source File: PreciseLocationActivity.java    From VirtualLocation with Apache License 2.0 6 votes vote down vote up
/**
 * 使组件变回原有形状
 * @param view
 */
private void repaintView(final View view){
    AnimatorSet set = new AnimatorSet();

    ValueAnimator animator = ValueAnimator.ofFloat(width, 0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float value = (Float) animation.getAnimatedValue();
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mBeginLocation
                    .getLayoutParams();
            params.leftMargin = (int) value;
            params.rightMargin = (int) value;
            view.setLayoutParams(params);
        }
    });

    ObjectAnimator animator2 = ObjectAnimator.ofFloat(view,
            "scaleX", 0.5f, 1f);
    set.setDuration(1000);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.playTogether(animator, animator2);
    set.start();
}
 
Example #9
Source File: RoundProgressView.java    From TwinklingRefreshLayout with Apache License 2.0 6 votes vote down vote up
private void init() {
    mPath = new Paint();
    mPantR = new Paint();
    mPantR.setColor(Color.WHITE);
    mPantR.setAntiAlias(true);
    mPath.setAntiAlias(true);
    mPath.setColor(Color.rgb(114, 114, 114));

    va = ValueAnimator.ofInt(0, 360);
    va.setDuration(720);
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            endAngle = (int) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    va.setRepeatCount(ValueAnimator.INFINITE);
    va.setInterpolator(new AccelerateDecelerateInterpolator());
}
 
Example #10
Source File: PixelateText.java    From HTextView with Apache License 2.0 6 votes vote down vote up
@Override public void animateText(CharSequence text) {
    mOldText = mText;
    mText = text;
    calc();

    int n = mText.length();
    n = n <= 0 ? 1 : n;

    long duration = (long) (charTime + charTime / mostCount * (n - 1));

    ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, duration).setDuration(duration);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override public void onAnimationUpdate(ValueAnimator animation) {
            progress = (float) animation.getAnimatedValue();
            mHTextView.invalidate();
        }
    });
    valueAnimator.start();
}
 
Example #11
Source File: ExpandableTextView.java    From Android-ExpandableTextView with Apache License 2.0 6 votes vote down vote up
public ExpandableTextView(final Context context, @Nullable final AttributeSet attrs, final int defStyle)
{
    super(context, attrs, defStyle);

    // read attributes
    final TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.ExpandableTextView, defStyle, 0);
    this.animationDuration = attributes.getInt(R.styleable.ExpandableTextView_animation_duration, BuildConfig.DEFAULT_ANIMATION_DURATION);
    attributes.recycle();

    // keep the original value of maxLines
    this.maxLines = this.getMaxLines();

    // create bucket of OnExpandListener instances
    this.onExpandListeners = new ArrayList<>();

    // create default interpolators
    this.expandInterpolator = new AccelerateDecelerateInterpolator();
    this.collapseInterpolator = new AccelerateDecelerateInterpolator();
}
 
Example #12
Source File: FragmentMusicView.java    From Pas with Apache License 2.0 6 votes vote down vote up
@Override
public void initWeidget() {
    ButterKnife.bind(this, getRootView());

    //ivicon旋转
    animator = ObjectAnimator.ofFloat(ivIcon, "rotation", 0, 360);
    animator.setDuration(15000);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(ValueAnimator.INFINITE);

    //透明度动画
    animator1 = ObjectAnimator.ofFloat(rlBg, "alpha", 0.2f, 1.0f);
    animator1.setDuration(2000);
    animator1.setInterpolator(new AccelerateDecelerateInterpolator());


}
 
Example #13
Source File: DetailActivity.java    From MaterialWpp with Apache License 2.0 6 votes vote down vote up
private void hideOrShowToolbar() {
    appBarLayout.animate()
            .translationY(ishide ? 0 : -appBarLayout.getHeight())
            .setInterpolator(new DecelerateInterpolator())
            .start();
    floatingActionButton.animate()
            .scaleX(ishide?1.0F:0.0F)
            .scaleY(ishide?1.0F:0.0F)
            .alpha(ishide?0.8F:0.0F)
            .setInterpolator(new AccelerateDecelerateInterpolator())
            .setDuration(500)
            .start();
    linearLayout.animate()
            .translationY(ishide?0:-(appBarLayout.getHeight()+linearLayout.getHeight()))
            .setInterpolator(new DecelerateInterpolator())
            .setDuration(1000)
            .start();
    ishide = !ishide;

}
 
Example #14
Source File: CircularActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 6 votes vote down vote up
private void simulateErrorProgress(final CircularProgressButton button) {
    ValueAnimator widthAnimation = ValueAnimator.ofInt(1, 99);
    widthAnimation.setDuration(1500);
    widthAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    widthAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer value = (Integer) animation.getAnimatedValue();
            button.setProgress(value);
            if (value == 99) {
                button.setProgress(-1);
            }
        }
    });
    widthAnimation.start();
}
 
Example #15
Source File: AnimationUtil.java    From FileManager with Apache License 2.0 6 votes vote down vote up
/**
 * @param view           展开动画的view
 * @param centerX        从具体某个点的X坐标开始扩散
 * @param centerY        从具体某个点的Y坐标开始扩散
 * @param MultipleRadius 半径倍数
 * @param Duration       动画时间
 * @return
 */
public static Animator getCircularReveal(View view, int centerX, int centerY, int MultipleRadius, int Duration) {

    int cx = (view.getLeft() + view.getRight()) / 2;
    int cy = (view.getTop() + view.getBottom()) / 2;

    int dx = Math.max(cx, view.getWidth() - cx);
    int dy = Math.max(cy, view.getHeight() - cy);
    float finalRadius = (float) Math.hypot(dx, dy);

    // Android native animator
    Animator animator =
            ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius * MultipleRadius);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(Duration);
    return animator;
}
 
Example #16
Source File: TimerFragmentMain.java    From TwistyTimer with GNU General Public License v3.0 6 votes vote down vote up
private void updateHistorySwitchItem() {
    if (history) {
        navButtonHistory.setImageResource(R.drawable.ic_history_on);
        navButtonHistory.animate()
                .rotation(-135)
                .setInterpolator(new AccelerateDecelerateInterpolator())
                .setDuration(300)
                .start();
    } else {
        navButtonHistory.setImageResource(R.drawable.ic_history_off);
        navButtonHistory.animate()
                .rotation(0)
                .setInterpolator(new AccelerateDecelerateInterpolator())
                .setDuration(300)
                .start();
    }
}
 
Example #17
Source File: PhoneTabSwitcherLayout.java    From ChromeLikeTabSwitcher with Apache License 2.0 6 votes vote down vote up
/**
 * Creates and returns a layout listener, which allows to start a peek animation to add a tab,
 * once its view has been inflated.
 *
 * @param item
 *         The item, which corresponds to the tab, which should be added, as an instance of the
 *         class {@link AbstractItem}. The item may not be null
 * @param peekAnimation
 *         The peek animation, which should be started, as an instance of the class {@link
 *         PeekAnimation}. The peek animation may not be null
 * @return The listener, which has been created, as an instance of the type {@link
 * OnGlobalLayoutListener}. The listener may not be null
 */
private OnGlobalLayoutListener createPeekLayoutListener(@NonNull final AbstractItem item,
                                                        @NonNull final PeekAnimation peekAnimation) {
    return new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            long totalDuration =
                    peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() :
                            peekAnimationDuration;
            long duration = totalDuration / 3;
            Interpolator interpolator =
                    peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() :
                            new AccelerateDecelerateInterpolator();
            float peekPosition =
                    getArithmetics().getTabContainerSize(Axis.DRAGGING_AXIS, false) * 0.66f;
            animatePeek(item, duration, interpolator, peekPosition, peekAnimation);
        }

    };
}
 
Example #18
Source File: RecordingThrobberView.java    From science-journal with Apache License 2.0 6 votes vote down vote up
public void startAnimation() {
  for (int i = 0; i < NUMBER_BARS; i++) {
    final int index = i;
    ValueAnimator animator = ValueAnimator.ofFloat(0, 100);
    animator.setDuration(MS_PER_CYCLE);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    // Get sorta random starts using some prime numbers and modulo math
    animator.setCurrentPlayTime(
        (long) (MS_PER_CYCLE * (i * 3 + 7 * 1.0 % NUMBER_BARS) / NUMBER_BARS));
    animator.addUpdateListener(
        valueAnimator -> {
          animatedFraction[index] = valueAnimator.getAnimatedFraction();
          // Coordinate the invalidates for performance.
          postInvalidateOnAnimation();
        });
    animator.start();
    stopped.happensNext().subscribe(() -> animator.end());
  }
}
 
Example #19
Source File: BackgroundView.java    From BackgroundView with Apache License 2.0 6 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    initBézierCurve(w);

    /**
     *可根据不同需求设置不同差值器,产生不同的叶子飘动效果
     */
    mAnimators.add(startLeafAnimation(mLeaf1, w, 200, 5000, 0, new AccelerateInterpolator()));
    mAnimators.add(startLeafAnimation(mLeaf2, w, 200, 5000, 3000, new AccelerateDecelerateInterpolator()));
    mAnimators.add(startLeafAnimation(mLeaf3, w, 200, 5000, 2000, new OvershootInterpolator()));
    mAnimators.add(startLeafAnimation(mLeaf4, w, 200, 5000, 4000, new DecelerateInterpolator()));

    mAnimators.add(startCloudAnimation(mCloud1, w, 30000, 0));
    mAnimators.add(startCloudAnimation(mCloud2, w, 30000, 4000));
    mAnimators.add(startCloudAnimation(mCloud3, w, 30000, 8000));
}
 
Example #20
Source File: MainActivity.java    From WanAndroid with Apache License 2.0 6 votes vote down vote up
/**
 * 隐藏floatingButton
 */
@SuppressLint("RestrictedApi")
private void hideFloatingButton(){
    if(fbtnUp.getVisibility() == View.VISIBLE){
        mHideFbtnAnimator = fbtnUp.animate().setDuration(300).setInterpolator(new AccelerateDecelerateInterpolator()).translationY(
                TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, 400, getResources().getDisplayMetrics())
        );
        mHideFbtnAnimator.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                fbtnUp.setVisibility(View.INVISIBLE);
            }
        });
        mHideFbtnAnimator.start();
    }
}
 
Example #21
Source File: AppFileListFragment.java    From AppPlus with MIT License 6 votes vote down vote up
private void setupRecyclerView(View rootView) {
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));

    //every item's height is fix so use this method
    //RecyclerView can perform several optimizations
    mRecyclerView.setHasFixedSize(true);
    mAdapter = new AppFileListAdapter(getActivity());
    mAdapter.setClickPopupMenuItem(this);
    mAdapter.setClickListItem(this);

    SlideInBottomAnimationAdapter slideInLeftAdapter = new SlideInBottomAnimationAdapter(mAdapter);
    slideInLeftAdapter.setDuration(300);
    slideInLeftAdapter.setInterpolator(new AccelerateDecelerateInterpolator());

    mRecyclerView.setAdapter(slideInLeftAdapter);
}
 
Example #22
Source File: MonthWeekMaterialCalendarView.java    From monthweekmaterialcalendarview with Apache License 2.0 6 votes vote down vote up
private void setUpdateBottomAndTopAnimator(int fromY, int toY, long duration, final SlideOffsetAnimatorlistener listener) {
        ValueAnimator animator = new ValueAnimator();
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
//        animator.setEvaluator(new TypeEvaluator<Integer>() {
//            @Override
//            public Integer evaluate(float fraction, Integer start, Integer end) {
//                return (int) (start + (end - start) * fraction);
//            }
//        });
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                if (listener != null) {
                    listener.onAnimationUpdate(valueAnimator);
                }
            }
        });
        animator.setIntValues(fromY, toY);
        animator.setDuration(duration);
        animator.start();
    }
 
Example #23
Source File: RoundProgressView.java    From AgentWebX5 with Apache License 2.0 6 votes vote down vote up
private void init() {
    mPath = new Paint();
    mPantR = new Paint();
    mPantR.setColor(Color.WHITE);
    mPantR.setAntiAlias(true);
    mPath.setAntiAlias(true);
    mPath.setColor(Color.rgb(114, 114, 114));

    va = ValueAnimator.ofInt(0, 360);
    va.setDuration(720);
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            endAngle = (int) animation.getAnimatedValue();
            postInvalidate();
        }
    });
    va.setRepeatCount(ValueAnimator.INFINITE);
    va.setInterpolator(new AccelerateDecelerateInterpolator());
}
 
Example #24
Source File: NumberAnimTextView.java    From NumberAnimTextView with MIT License 6 votes vote down vote up
private void start() {
    if (!mIsEnableAnim) {
        // 禁止动画
        setText(mPrefixString + format(new BigDecimal(mNumEnd)) + mPostfixString);
        return;
    }
    animator = ValueAnimator.ofObject(new BigDecimalEvaluator(), new BigDecimal(mNumStart), new BigDecimal(mNumEnd));
    animator.setDuration(mDuration);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            BigDecimal value = (BigDecimal) valueAnimator.getAnimatedValue();
            setText(mPrefixString + format(value) + mPostfixString);
        }
    });
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            setText(mPrefixString + mNumEnd + mPostfixString);
        }
    });
    animator.start();
}
 
Example #25
Source File: DeviceServicesActivity.java    From EFRConnect-android with Apache License 2.0 6 votes vote down vote up
private void animateToolbarClose(int openPercentHeight, int duration) {
    ValueAnimator animator = ValueAnimator.ofInt(percentHeightToPx(openPercentHeight), 0).setDuration(duration);


    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer value = (Integer) animation.getAnimatedValue();
            frameLayout.getLayoutParams().height = value;
            frameLayout.requestLayout();
        }
    });

    AnimatorSet set = new AnimatorSet();
    set.play(animator);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.start();
}
 
Example #26
Source File: FlowerAnimation.java    From Mobike with Apache License 2.0 6 votes vote down vote up
public void a()
{
  if ((this.b != null) && (this.b.isRunning()))
    this.b.cancel();
  this.b = ObjectAnimator.ofFloat(this, "phase1", new float[] { 0.0F, 1.0F });
  this.b.setDuration(3 * this.k / 2);
  this.b.addUpdateListener(this);
  this.b.setInterpolator(new AccelerateInterpolator());
  this.b.start();
  if ((this.c != null) && (this.c.isRunning()))
    this.c.cancel();
  this.c = ObjectAnimator.ofFloat(this, "phase2", new float[] { 0.0F, 1.0F });
  this.c.setDuration(2 * (this.k / 3));
  this.c.addUpdateListener(this);
  this.c.setStartDelay(2 * this.l);
  this.c.start();
  this.c.setInterpolator(new AccelerateDecelerateInterpolator());
  if ((this.d != null) && (this.d.isRunning()))
    this.d.cancel();
  this.d = ObjectAnimator.ofFloat(this, "phase3", new float[] { 0.0F, 1.0F });
  this.d.setDuration(this.k / 3);
  this.d.addUpdateListener(this);
  this.d.setInterpolator(new AccelerateInterpolator(2.0F));
  this.d.setStartDelay(4 * this.l);
  this.d.start();
}
 
Example #27
Source File: SilentActivity.java    From KUAS-AP-Material with MIT License 6 votes vote down vote up
public void setDisplayHomeAsUp(boolean value) {
	if (value == isDisplayHomeAsUp) {
		return;
	} else {
		isDisplayHomeAsUp = value;
	}

	ValueAnimator anim;
	if (value) {
		anim = ValueAnimator.ofFloat(0f, 1f);
	} else {
		anim = ValueAnimator.ofFloat(1f, 0f);
	}
	anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

		@Override
		public void onAnimationUpdate(ValueAnimator valueAnimator) {
			float slideOffset = (float) valueAnimator.getAnimatedValue();
			setDrawerIconState(slideOffset);
		}
	});
	anim.setInterpolator(new AccelerateDecelerateInterpolator());
	anim.setDuration(300);
	anim.start();
}
 
Example #28
Source File: FolderPopUpWindow.java    From imsdk-android with MIT License 5 votes vote down vote up
private void enterAnimator() {
    ObjectAnimator alpha = ObjectAnimator.ofFloat(masker, "alpha", 0, 1);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(listView, "translationY", listView.getHeight(), 0);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(400);
    set.playTogether(alpha, translationY);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.start();
}
 
Example #29
Source File: FlipAnimation.java    From CreditCardView with MIT License 5 votes vote down vote up
/**
 * Creates a 3D flip animation between two views.
 *
 * @param fromView First view in the transition.
 * @param toView   Second view in the transition.
 */
public FlipAnimation(View fromView, View toView) {
    this.fromView = fromView;
    this.toView = toView;

    setDuration(700);
    setFillAfter(false);
    setInterpolator(new AccelerateDecelerateInterpolator());
}
 
Example #30
Source File: MarkerDrawable.java    From discreteSeekBar with Apache License 2.0 5 votes vote down vote up
public MarkerDrawable(@NonNull ColorStateList tintList, int closedSize) {
    super(tintList);
    mInterpolator = new AccelerateDecelerateInterpolator();
    mClosedStateSize = closedSize;
    mStartColor = tintList.getColorForState(new int[]{android.R.attr.state_enabled, android.R.attr.state_pressed}, tintList.getDefaultColor());
    mEndColor = tintList.getDefaultColor();

}