当前位置: 首页>>代码示例>>Java>>正文


Java TimeInterpolator类代码示例

本文整理汇总了Java中android.animation.TimeInterpolator的典型用法代码示例。如果您正苦于以下问题:Java TimeInterpolator类的具体用法?Java TimeInterpolator怎么用?Java TimeInterpolator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TimeInterpolator类属于android.animation包,在下文中一共展示了TimeInterpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startTranslatePlayListAnim

import android.animation.TimeInterpolator; //导入依赖的package包/类
private void startTranslatePlayListAnim(float from, float to, int duration, final View view, @Nullable TimeInterpolator interpolator, @Nullable Animator.AnimatorListener listener) {
    final ValueAnimator anim = ObjectAnimator.ofFloat(from, to);
    anim.setDuration(duration);
    if (interpolator != null)
        anim.setInterpolator(interpolator);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float va = (float) animation.getAnimatedValue();
            view.setY(va);
        }
    });
    if (listener != null) {
        anim.addListener(listener);
    }
    anim.start();
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:18,代码来源:BottomNavigationController.java

示例2: onAnimationUpdate

import android.animation.TimeInterpolator; //导入依赖的package包/类
@Override
public void onAnimationUpdate(ValueAnimator animation) {
  if (view.getLayoutParams() != null) {
    ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    TimeInterpolator interpolator = animation.getInterpolator();
    float fraction = animation.getAnimatedFraction();
    if (width != null) {
      layoutParams.width = intEvaluator.evaluate(interpolator.getInterpolation(fraction),
                                                 width.first,
                                                 width.second);
    }
    if (height != null) {
      layoutParams.height = intEvaluator.evaluate(interpolator.getInterpolation(fraction),
                                                  height.first,
                                                  height.second);
    }
    view.requestLayout();
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:DimensionUpdateListener.java

示例3: getTimeInterpolater

import android.animation.TimeInterpolator; //导入依赖的package包/类
private TimeInterpolator getTimeInterpolater() {
    switch (mAnimationStyle) {
        case ViewBaseCommon.ANIMATION_LINEAR:
            return new LinearInterpolator();
        case ViewBaseCommon.ANIMATION_DECELERATE:
            return new DecelerateInterpolator();
        case ViewBaseCommon.ANIMATION_ACCELERATE:
            return new AccelerateInterpolator();
        case ViewBaseCommon.ANIMATION_ACCELERATEDECELERATE:
            return new AccelerateDecelerateInterpolator();
        case ViewBaseCommon.ANIMATION_SPRING:
            return new SpringInterpolator();
        default:
            return new LinearInterpolator();
    }
}
 
开发者ID:alibaba,项目名称:Virtualview-Android,代码行数:17,代码来源:PageView.java

示例4: prepareAnimators

import android.animation.TimeInterpolator; //导入依赖的package包/类
@Override
public void prepareAnimators(DepthRelativeLayout target, int index, int animationDelay) {
    final TimeInterpolator interpolator = new ExpoIn();

    final float finalTranslationY = exitConfiguration.getFinalYPercent() * target.getResources().getDisplayMetrics().heightPixels;
    final float finalTranslationX = exitConfiguration.getFinalXPercent() * target.getResources().getDisplayMetrics().widthPixels;

    final long totalDuration = exitConfiguration.getDuration();

    final ObjectAnimator translationY2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_Y, finalTranslationY);
    translationY2.setDuration(totalDuration);
    //translationY2.setInterpolator(new AccelerateInterpolator());
    translationY2.setInterpolator(interpolator);
    translationY2.setStartDelay(animationDelay);
    attachListener(translationY2);
    add(translationY2);

    final ObjectAnimator translationX2 = ObjectAnimator.ofFloat(target, View.TRANSLATION_X, finalTranslationX);
    translationX2.setDuration(totalDuration);
    translationX2.setInterpolator(interpolator);
    translationX2.setStartDelay(animationDelay);
    add(translationX2);
}
 
开发者ID:florent37,项目名称:Depth,代码行数:24,代码来源:ExitAnimation.java

示例5: preparePartialTransition_setsPartialInterpolator

import android.animation.TimeInterpolator; //导入依赖的package包/类
@Test
public void preparePartialTransition_setsPartialInterpolator() {
    //given
    final StaggeredAnimationGroup spiedGroup = prepareSpiedGroup();
    final TimeInterpolator testInterpolator = new LinearOutSlowInInterpolator();
    final Transition spiedTransition = spy(new AutoTransition());
    final StaggeredAnimationGroup.PartialTransitionFactory factory =
            new StaggeredAnimationGroup.PartialTransitionFactory() {
                @Override
                public Transition createPartialTransition(boolean show, int viewId, int indexInTransition) {
                    return spiedTransition;
                }
            };
    spiedGroup.setPartialTransitionFactory(factory);
    spiedGroup.setPartialInterpolator(testInterpolator);

    //when
    spiedGroup.preparePartialTransition(true, 0, 0);

    //then
    verify(spiedTransition, times(1)).setInterpolator(testInterpolator);
}
 
开发者ID:blipinsk,项目名称:StaggeredAnimationGroup,代码行数:23,代码来源:StaggeredAnimationGroupTest.java

示例6: setInterpolator

import android.animation.TimeInterpolator; //导入依赖的package包/类
public T setInterpolator(TimeInterpolator interpolator) {
    if(mCurrentCustomInterpolator != null) {
        switchInterpolator(interpolator);
    } else {
        getValueAnimator().setInterpolator(interpolator);
    }
    return self();
}
 
开发者ID:wirecube,项目名称:android_additive_animations,代码行数:9,代码来源:BaseAdditiveAnimator.java

示例7: setTimeInterpolator

import android.animation.TimeInterpolator; //导入依赖的package包/类
/**
 * Set TimeInterpolator for all page animations.
 *
 * @param interpolator TimeInterpolator
 */
public void setTimeInterpolator(TimeInterpolator interpolator) {
    if (pageAnimations == null) return;
    for (ArrayList<PageAnimation> pageAnimationsInSamePage : pageAnimations) {
        if (pageAnimationsInSamePage == null) continue;
        for (PageAnimation pageAnimation : pageAnimationsInSamePage) pageAnimation.setTimeInterpolator(interpolator);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ViewAnimation.java

示例8: runExitAnimation

import android.animation.TimeInterpolator; //导入依赖的package包/类
private static void runExitAnimation(final Activity activity,
                                     ArrayList<EasyTransitionOptions.ViewAttrs> attrs,
                                     long duration,
                                     TimeInterpolator interpolator) {
    if (null == attrs || attrs.size() == 0)
        return;

    for (final EasyTransitionOptions.ViewAttrs attr : attrs) {
        View view = activity.findViewById(attr.id);
        int[] location = new int[2];
        view.getLocationOnScreen(location);
        view.setPivotX(0);
        view.setPivotY(0);

        view.animate()
                .scaleX(attr.width / view.getWidth())
                .scaleY(attr.height / view.getHeight())
                .translationX(attr.startX - location[0])
                .translationY(attr.startY - location[1])
                .setInterpolator(interpolator)
                .setDuration(duration);
    }

    activity.findViewById(attrs.get(0).id).postDelayed(new Runnable() {
        @Override
        public void run() {
            activity.finish();
            activity.overridePendingTransition(0, 0);
        }
    }, duration);
}
 
开发者ID:huzenan,项目名称:EasyTransition,代码行数:32,代码来源:EasyTransition.java

示例9: snapToPage

import android.animation.TimeInterpolator; //导入依赖的package包/类
protected void snapToPage(int whichPage, int duration, boolean immediate,
        TimeInterpolator interpolator) {
    whichPage = validateNewPage(whichPage);

    int newX = getScrollForPage(whichPage);
    final int delta = newX - getUnboundedScrollX();
    snapToPage(whichPage, delta, duration, immediate, interpolator);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:9,代码来源:PagedView.java

示例10: snapToPage

import android.animation.TimeInterpolator; //导入依赖的package包/类
protected void snapToPage(int whichPage, int delta, int duration, boolean immediate,
        TimeInterpolator interpolator) {
    whichPage = validateNewPage(whichPage);

    mNextPage = whichPage;

    pageBeginMoving();
    awakenScrollBars(duration);
    if (immediate) {
        duration = 0;
    } else if (duration == 0) {
        duration = Math.abs(delta);
    }

    if (!mScroller.isFinished()) {
        abortScrollerAnimation(false);
    }

    if (interpolator != null) {
        mScroller.setInterpolator(interpolator);
    } else {
        mScroller.setInterpolator(mDefaultInterpolator);
    }

    mScroller.startScroll(getUnboundedScrollX(), 0, delta, 0, duration);

    updatePageIndicator();

    // Trigger a compute() to finish switching pages if necessary
    if (immediate) {
        computeScroll();
    }

    mForceScreenScrolled = true;
    invalidate();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:37,代码来源:PagedView.java

示例11: hideTargets

import android.animation.TimeInterpolator; //导入依赖的package包/类
private void hideTargets(boolean animate, boolean expanded) {
    mTargetAnimations.cancel();
    // Note: these animations should complete at the same time so that we can swap out
    // the target assets asynchronously from the setTargetResources() call.
    mAnimatingTargets = animate;
    final int duration = animate ? HIDE_ANIMATION_DURATION : 0;
    final int delay = animate ? HIDE_ANIMATION_DELAY : 0;

    final float targetScale = expanded ?
            TARGET_SCALE_EXPANDED : TARGET_SCALE_COLLAPSED;
    final int length = mTargetDrawables.size();
    final TimeInterpolator interpolator = Ease.Cubic.easeOut;
    for (int i = 0; i < length; i++) {
        TargetDrawable target = mTargetDrawables.get(i);
        target.setState(TargetDrawable.STATE_INACTIVE);
        mTargetAnimations.add(Tweener.to(target, duration,
                "ease", interpolator,
                "alpha", 0.0f,
                "scaleX", targetScale,
                "scaleY", targetScale,
                "delay", delay,
                "onUpdate", mUpdateListener));
    }

    float ringScaleTarget = expanded ?
            RING_SCALE_EXPANDED : RING_SCALE_COLLAPSED;
    ringScaleTarget *= mRingScaleFactor;
    mTargetAnimations.add(Tweener.to(mOuterRing, duration,
            "ease", interpolator,
            "alpha", 0.0f,
            "scaleX", ringScaleTarget,
            "scaleY", ringScaleTarget,
            "delay", delay,
            "onUpdate", mUpdateListener,
            "onComplete", mTargetUpdateListener));

    mTargetAnimations.start();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:39,代码来源:GlowPadView.java

示例12: startTranslateYAnim

import android.animation.TimeInterpolator; //导入依赖的package包/类
public static void startTranslateYAnim(float from, float to, int duration, final View view, @Nullable TimeInterpolator interpolator) {
    final ValueAnimator anim = ObjectAnimator.ofFloat(from, to);
    anim.setDuration(duration);
    if (interpolator != null)
        anim.setInterpolator(interpolator);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float va = (float) animation.getAnimatedValue();
            view.setY(va);
        }
    });
    anim.start();
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:15,代码来源:AnimationUtils.java

示例13: toggle

import android.animation.TimeInterpolator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void toggle(final long duration, final @Nullable TimeInterpolator interpolator) {
    if (closePosition < getCurrentPosition()) {
        collapse(duration, interpolator);
    } else {
        expand(duration, interpolator);
    }
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:12,代码来源:ExpandableLinearLayout.java

示例14: expand

import android.animation.TimeInterpolator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void expand(final long duration, final @Nullable TimeInterpolator interpolator) {
    if (isAnimating) return;

    if (duration <= 0) {
        move(layoutSize, duration, interpolator);
        return;
    }
    createExpandAnimator(getCurrentPosition(), layoutSize, duration, interpolator).start();
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:14,代码来源:ExpandableLinearLayout.java

示例15: collapse

import android.animation.TimeInterpolator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void collapse(final long duration, final @Nullable TimeInterpolator interpolator) {
    if (isAnimating) return;

    if (duration <= 0) {
        move(closePosition, duration, interpolator);
        return;
    }
    createExpandAnimator(getCurrentPosition(), closePosition, duration, interpolator).start();
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:14,代码来源:ExpandableLinearLayout.java


注:本文中的android.animation.TimeInterpolator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。