java类android.view.animation.LinearInterpolator的实例源码

SquareSpinIndicator.java 文件源码 项目:ImitateZHRB 阅读 30 收藏 0 点赞 0 评论 0
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();
    animators.add(animator);
    return animators;
}
LabelLayout.java 文件源码 项目:revolution-irc 阅读 27 收藏 0 点赞 0 评论 0
public LabelLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setWillNotDraw(false);
    setAddStatesFromChildren(true);

    mInputFrame = new FrameLayout(context);
    mInputFrame.setAddStatesFromChildren(true);
    super.addView(mInputFrame, -1, generateDefaultLayoutParams());

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mTextPaint.setTypeface(Typeface.DEFAULT);// getTypeface());
    mTextSizeCollapsed = getResources().getDimensionPixelSize(R.dimen.abc_text_size_caption_material);
    mTextSizeExpanded = getResources().getDimensionPixelSize(R.dimen.abc_text_size_medium_material);
    mTextPaint.setTextSize(mTextSizeCollapsed);

    StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(context, attrs,
            new int[] { R.attr.doNotExpand, android.R.attr.hint, android.R.attr.textColorHint });
    try {
        mDoNotExpand = ta.getBoolean(R.attr.doNotExpand, false);
        mHint = ta.getString(android.R.attr.hint);
        mTextColorUnfocused = ta.getColorStateList(android.R.attr.textColorHint);
    } finally {
        ta.recycle();
    }
    mTextColorFocused = ThemeHelper.getAccentColor(context);
    mTextPaint.setColor(mTextColorUnfocused.getColorForState(getDrawableState(), mTextColorUnfocused.getDefaultColor()));

    mAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mAnimator.setInterpolator(new LinearInterpolator());
    mAnimator.setDuration(200);
    mAnimator.addUpdateListener((ValueAnimator animation) -> {
        mAnimState = (float) animation.getAnimatedValue();
        invalidate();
    });

    updateTopMargin();
    updateTextPositions();
}
ToolbarScrollHideHandler.java 文件源码 项目:Slide-RSS 阅读 25 收藏 0 点赞 0 评论 0
private void toolbarAnimateShow(final int verticalOffset) {
    mAppBar.animate()
            .translationY(0)
            .setInterpolator(new LinearInterpolator())
            .setDuration(180);
    if (extra != null)
        extra.animate()
                .translationY(0)
                .setInterpolator(new LinearInterpolator())
                .setDuration(180);
}
ControllerActivity.java 文件源码 项目:Make-A-Pede-Android-App 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void onBluetoothConnectionEvent(String event) {
    switch (event) {
        case ACTION_CONNECTED:
            progress.hide();
            bluetoothConnection.subscribeToHeadingNotifications((heading) -> {
                if(heading != null) {
                    int r = 360 - (int) (Float.parseFloat(heading));

                    int headingDelta = r-currentHeading;
                    currentHeading = r;

                    headingIndicator.setVisibility(View.VISIBLE);

                    headingIndicator.animate()
                                    .rotationBy(headingDelta)
                                    .setDuration(99)
                                    .setInterpolator(new LinearInterpolator())
                                    .start();
                }
            });
            break;

        case ACTION_DISCONNECTED:
        case ACTION_ERROR:
            finish();
            break;
    }
}
LoadingRefreshHeader.java 文件源码 项目:LJFramework 阅读 23 收藏 0 点赞 0 评论 0
private Animator createLoadingAnimator() {
    ObjectAnimator rotation = ObjectAnimator
            .ofFloat(mImgLoading, "rotation", 0, 360);
    //RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotation.setRepeatCount(ObjectAnimator.INFINITE);
    rotation.setRepeatMode(ObjectAnimator.RESTART);
    rotation.setInterpolator(new LinearInterpolator());
    rotation.setDuration(mLoadingTime);
    return rotation;
}
LoaderController.java 文件源码 项目:loaderviewlibrary-shading 阅读 24 收藏 0 点赞 0 评论 0
private void setValueAnimator(float begin, float end, int repeatCount) {
    valueAnimator = ValueAnimator.ofFloat(begin, end);
    valueAnimator.setRepeatCount(repeatCount);
    valueAnimator.setDuration(ANIMATION_CYCLE_DURATION);
    valueAnimator.setRepeatMode(ValueAnimator.REVERSE);
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            progress = (float) animation.getAnimatedValue();
            loaderView.invalidate();
        }
    });
}
ScaleAnimator.java 文件源码 项目:AndroidSkinAnimator 阅读 20 收藏 0 点赞 0 评论 0
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("ScaleX",
                    1, 0),
            PropertyValuesHolder.ofFloat("ScaleY",
                    1, 0))
            .setDuration(PRE_DURATION * 3);
    preAnimator.setInterpolator(new LinearInterpolator());
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("ScaleX",
                    0, 1),
            PropertyValuesHolder.ofFloat("ScaleY",
                    0, 1))
            .setDuration(AFTER_DURATION * 2);
    afterAnimator.setInterpolator(new OvershootInterpolator());

    preAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });

    return this;
}
LoadingView.java 文件源码 项目:GitHub 阅读 29 收藏 0 点赞 0 评论 0
private void buildAnimator() {
    final ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(ANIMATOR_DURATION);
    valueAnimator.setRepeatCount(-1);
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mRotation = (float) valueAnimator.getAnimatedValue();
            invalidate();
        }
    });
    animator = valueAnimator;
    animatorSet = buildFlexibleAnimation();
    animatorSet.addListener(animatorListener);
}
ReadEPubActivity.java 文件源码 项目:GitHub 阅读 39 收藏 0 点赞 0 评论 0
private void toolbarAnimateShow(final int verticalOffset) {
    showStatusBar();
    mCommonToolbar.animate()
            .translationY(0)
            .setInterpolator(new LinearInterpolator())
            .setDuration(180)
            .setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationStart(Animator animation) {
                    toolbarSetElevation(verticalOffset == 0 ? 0 : 1);
                }
            });

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (mIsActionBarVisible) {
                        toolbarAnimateHide();
                    }
                }
            });
        }
    }, 10000);

    mIsActionBarVisible = true;
}
MediaSeekBar.java 文件源码 项目:mediasession-mediaplayer 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void onPlaybackStateChanged(PlaybackStateCompat state) {
    super.onPlaybackStateChanged(state);

    // If there's an ongoing animation, stop it now.
    if (mProgressAnimator != null) {
        mProgressAnimator.cancel();
        mProgressAnimator = null;
    }

    final int progress = state != null
            ? (int) state.getPosition()
            : 0;
    setProgress(progress);
    Log.d("nicole", "Set progress to: " + (progress / 1000.0f));

    // If the media is playing then the seekbar should follow it, and the easiest
    // way to do that is to create a ValueAnimator to update it so the bar reaches
    // the end of the media the same time as playback gets there (or close enough).
    if (state != null && state.getState() == PlaybackStateCompat.STATE_PLAYING) {
        final int timeToEnd = (int) ((getMax() - progress) / state.getPlaybackSpeed());

        mProgressAnimator = ValueAnimator.ofInt(progress, getMax())
                .setDuration(timeToEnd);
        mProgressAnimator.setInterpolator(new LinearInterpolator());
        mProgressAnimator.addUpdateListener(this);
        mProgressAnimator.start();
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号