android.view.animation.ScaleAnimation#setInterpolator()源码实例Demo

下面列出了android.view.animation.ScaleAnimation#setInterpolator() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: material-sheet-fab   文件: Fab.java
/**
 * Hides the FAB.
 */
@Override
public void hide() {
	// Only use scale animation if FAB is visible
	if (getVisibility() == View.VISIBLE) {
		// Pivots indicate where the animation begins from
		float pivotX = getPivotX() + getTranslationX();
		float pivotY = getPivotY() + getTranslationY();

		// Animate FAB shrinking
		ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY);
		anim.setDuration(FAB_ANIM_DURATION);
		anim.setInterpolator(getInterpolator());
		startAnimation(anim);
	}
	setVisibility(View.INVISIBLE);
}
 
源代码2 项目: faveo-helpdesk-android-app   文件: Fab.java
/**
 * Hides the FAB.
 */
@Override
public void hide() {
    // Only use scale animation if FAB is visible
    if (getVisibility() == View.VISIBLE) {
        // Pivots indicate where the animation begins from
        float pivotX = getPivotX() + getTranslationX();
        float pivotY = getPivotY() + getTranslationY();

        // Animate FAB shrinking
        ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY);
        anim.setDuration(FAB_ANIM_DURATION);
        anim.setInterpolator(getInterpolator());
        startAnimation(anim);
    }
    setVisibility(View.INVISIBLE);
}
 
源代码3 项目: faveo-helpdesk-android-app   文件: Fab.java
/**
 * Hides the FAB.
 */
@Override
public void hide() {
    // Only use scale animation if FAB is visible
    if (getVisibility() == View.VISIBLE) {
        // Pivots indicate where the animation begins from
        float pivotX = getPivotX() + getTranslationX();
        float pivotY = getPivotY() + getTranslationY();

        // Animate FAB shrinking
        ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, pivotX, pivotY);
        anim.setDuration(FAB_ANIM_DURATION);
        anim.setInterpolator(getInterpolator());
        startAnimation(anim);
    }
    setVisibility(View.INVISIBLE);
}
 
/**
 * 中间的View动画播放
 */
private void playCenter() {
    AnimationSet animationSet = new AnimationSet(false);
    ScaleAnimation scaleSmall = new ScaleAnimation(1.0f, 0.6f, 1.0f, 0.6f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    ScaleAnimation scaleBig = new ScaleAnimation(1.0f, 5.0f/3, 1.0f, 5.0f/3,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleBig.setDuration(2*1000);
    scaleBig.setInterpolator(interpolator);
    scaleSmall.setDuration(2*1000);
    scaleSmall.setStartOffset(2*1000);
    scaleSmall.setRepeatCount(-1);
    scaleSmall.setFillEnabled(true);
    scaleSmall.setFillAfter(true);
    scaleBig.setStartOffset(2*1000);
    scaleBig.setRepeatCount(-1);
    scaleBig.setFillEnabled(true);
    scaleBig.setFillAfter(true);
    scaleSmall.setInterpolator(interpolator);
    animationSet.addAnimation(scaleBig);
    animationSet.addAnimation(scaleSmall);
    center.startAnimation(animationSet);
}
 
源代码5 项目: android-open-project-demo   文件: Utils.java
public static Animation createScaleAnimation(View view, int parentWidth, int parentHeight,
        int toX, int toY) {
    // Difference in X and Y
    final int diffX = toX - view.getLeft();
    final int diffY = toY - view.getTop();

    // Calculate actual distance using pythagors
    float diffDistance = FloatMath.sqrt((toX * toX) + (toY * toY));
    float parentDistance = FloatMath
            .sqrt((parentWidth * parentWidth) + (parentHeight * parentHeight));

    ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0f, 1f, 0f, Animation.ABSOLUTE,
            diffX,
            Animation.ABSOLUTE, diffY);
    scaleAnimation.setFillAfter(true);
    scaleAnimation.setInterpolator(new DecelerateInterpolator());
    scaleAnimation.setDuration(Math.round(diffDistance / parentDistance
            * Constants.SCALE_ANIMATION_DURATION_FULL_DISTANCE));

    return scaleAnimation;
}
 
源代码6 项目: actor-platform   文件: ViewUtils.java
public static void zoomInView(final View view) {
    if (view == null) {
        return;
    }


    if (view.getVisibility() != View.VISIBLE) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1f, 0, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(150);
        scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
        view.clearAnimation();
        view.startAnimation(scaleAnimation);
        view.setVisibility(View.VISIBLE);
    }

}
 
源代码7 项目: SimpleProject   文件: ViewAnimationUtil.java
public static void scale(View view, int fromX, int toX, int fromY, int toY, int duration, Interpolator interpolator) {
	ScaleAnimation animation = new ScaleAnimation(fromX, toX, fromY, toY);
	animation.setDuration(duration);
	animation.setFillAfter(true);
	animation.setInterpolator(interpolator);
	view.startAnimation(animation);
}
 
源代码8 项目: sketch   文件: ZoomInImageDisplayer.java
@Override
public void display(@NonNull SketchView sketchView, @NonNull Drawable newDrawable) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, 1.0f, fromY, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setInterpolator(interpolator);
    scaleAnimation.setDuration(duration);
    sketchView.clearAnimation();
    sketchView.setImageDrawable(newDrawable);
    sketchView.startAnimation(scaleAnimation);
}
 
源代码9 项目: RxTools-master   文件: RxAnimationTool.java
public static void ScaleUpDowm(View view) {
    ScaleAnimation animation = new ScaleAnimation(1.0f, 1.0f, 0.0f, 1.0f);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(1200);
    view.startAnimation(animation);
}
 
源代码10 项目: letv   文件: FragmentManagerImpl.java
static Animation makeOpenCloseAnimation(Context context, float startScale, float endScale, float startAlpha, float endAlpha) {
    AnimationSet set = new AnimationSet(false);
    ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale, 1, 0.5f, 1, 0.5f);
    scale.setInterpolator(DECELERATE_QUINT);
    scale.setDuration(220);
    set.addAnimation(scale);
    AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
    alpha.setInterpolator(DECELERATE_CUBIC);
    alpha.setDuration(220);
    set.addAnimation(alpha);
    return set;
}
 
源代码11 项目: direct-select-android   文件: DSListView.java
private void hideListView() {
    if (!readyToHide || animationInProgress || scrollInProgress || !listViewIsShown || adapter == null) return;

    readyToHide = false;
    animationInProgress = true;
    listView.setEnabled(false);

    this.setVisibility(View.INVISIBLE);

    this.pickerBox.onSelect(adapter.getItem(selectedItem), selectedItem);

    AlphaAnimation hideAnimation = new AlphaAnimation(1f, 0f);
    hideAnimation.setStartOffset(subScrollDuration);
    hideAnimation.setDuration(200);
    hideAnimation.setInterpolator(new DecelerateInterpolator());
    hideAnimation.setAnimationListener(new AnimationListenerAdapter() {
        @Override
        public void onAnimationEnd(Animation animation) {
            listViewIsShown = false;
            animationInProgress = false;
        }
    });
    DSListView.this.startAnimation(hideAnimation);

    // Scale picker box text animation if animations enabled
    if (selectorAnimationsEnabled && null != this.pickerBox) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta, 1f,
                Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setInterpolator(new DecelerateInterpolator());
        scaleAnimation.setStartOffset(100 + subScrollDuration);
        scaleAnimation.setDuration(100);
        scaleAnimation.setFillAfter(true);
        this.pickerBox.getCellRoot().startAnimation(scaleAnimation);
    }
}
 
源代码12 项目: direct-select-android   文件: DSListView.java
private void showListView() {
    if (animationInProgress || scrollInProgress || listViewIsShown) return;
    listView.setEnabled(true);
    animationInProgress = true;

    this.setVisibility(View.VISIBLE);
    this.bringToFront();
    this.readyToHide = false;

    // Scale picker box if animations enabled
    if (selectorAnimationsEnabled && null != this.pickerBox) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 1f + scaleFactorDelta, 1f, 1f + scaleFactorDelta,
                Animation.RELATIVE_TO_SELF, selectorAnimationCenterPivot ? 0.5f : 0f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setInterpolator(new AccelerateInterpolator());
        scaleAnimation.setDuration(100);
        scaleAnimation.setFillAfter(true);
        this.pickerBox.getCellRoot().startAnimation(scaleAnimation);
    }

    // Show picker view animation
    AlphaAnimation showAnimation = new AlphaAnimation(0f, 1f);
    showAnimation.setDuration(200);
    showAnimation.setInterpolator(new AccelerateInterpolator());
    showAnimation.setAnimationListener(new AnimationListenerAdapter() {
        @Override
        public void onAnimationEnd(Animation animation) {
            animationInProgress = false;
            listViewIsShown = true;
            hideListView();
        }
    });

    this.startAnimation(showAnimation);
}
 
源代码13 项目: android-recipes-app   文件: FragmentManager.java
static Animation makeOpenCloseAnimation(Context context, float startScale,
        float endScale, float startAlpha, float endAlpha) {
    AnimationSet set = new AnimationSet(false);
    ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale,
            Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
    scale.setInterpolator(DECELERATE_QUINT);
    scale.setDuration(ANIM_DUR);
    set.addAnimation(scale);
    AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
    alpha.setInterpolator(DECELERATE_CUBIC);
    alpha.setDuration(ANIM_DUR);
    set.addAnimation(alpha);
    return set;
}
 
源代码14 项目: JayPS-AndroidApp   文件: AltitudeFragment.java
private void animateAltitudeBars(ImageView[] views, float[] displayValues) {

        for(int v =0; v < views.length;v++) {
            views[v].setMaxHeight(_view.getHeight());
            ScaleAnimation scale = new ScaleAnimation(1, 1, _prevValues[v], displayValues[v], Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 1.0f);
            scale.setFillAfter(true);
            scale.setDuration(500);
            scale.setInterpolator(new AccelerateInterpolator(1.0f));
            views[v].startAnimation(scale);
        }

        _prevValues = displayValues;

    }
 
源代码15 项目: TvLauncher   文件: ScaleAnimEffect.java
public Animation createAnimation() {
    ScaleAnimation anim = new ScaleAnimation(fromXScale, toXScale, fromYScale, toYScale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setFillAfter(true);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.setDuration(duration);
    return anim;
}
 
源代码16 项目: PocketMaps   文件: MapActions.java
/**
 * start button: control button handler FAB
 */

private void initControlBtnHandler() {
    final ScaleAnimation anim = new ScaleAnimation(0, 1, 0, 1);
    anim.setFillBefore(true);
    anim.setFillAfter(true);
    anim.setFillEnabled(true);
    anim.setDuration(300);
    anim.setInterpolator(new OvershootInterpolator());

    controlBtn.setOnClickListener(new View.OnClickListener() {
        @Override public void onClick(View v) {
            if (isMenuVisible()) {
                setMenuVisible(false);
                sideBarMenuVP.setVisibility(View.INVISIBLE);
                favourBtn.setVisibility(View.INVISIBLE);
                settingsBtn.setVisibility(View.INVISIBLE);
                controlBtn.setImageResource(R.drawable.ic_keyboard_arrow_up_white_24dp);
                controlBtn.startAnimation(anim);
            } else {
                setMenuVisible(true);
                sideBarMenuVP.setVisibility(View.VISIBLE);
                favourBtn.setVisibility(View.VISIBLE);
                settingsBtn.setVisibility(View.VISIBLE);
                controlBtn.setImageResource(R.drawable.ic_keyboard_arrow_down_white_24dp);
                controlBtn.startAnimation(anim);
            }
        }
    });
}
 
源代码17 项目: V.FlyoutTest   文件: FragmentManager.java
static Animation makeOpenCloseAnimation(Context context, float startScale,
        float endScale, float startAlpha, float endAlpha) {
    AnimationSet set = new AnimationSet(false);
    ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale,
            Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
    scale.setInterpolator(DECELERATE_QUINT);
    scale.setDuration(ANIM_DUR);
    set.addAnimation(scale);
    AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
    alpha.setInterpolator(DECELERATE_CUBIC);
    alpha.setDuration(ANIM_DUR);
    set.addAnimation(alpha);
    return set;
}
 
源代码18 项目: actor-platform   文件: ViewUtils.java
public static void demoteView(final View view, boolean isAnimated) {
    if (view == null) {
        return;
    }

    if (isAnimated) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.1f, 1.0f, 1.1f, 1.0f, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
        scaleAnimation.setDuration(isAnimated ? 150 : 0);
        scaleAnimation.setInterpolator(MaterialInterpolator.getInstance());
        scaleAnimation.setFillAfter(true);
        view.clearAnimation();
        view.startAnimation(scaleAnimation);
    }
}
 
源代码19 项目: guideshow   文件: FragmentManager.java
static Animation makeOpenCloseAnimation(Context context, float startScale,
        float endScale, float startAlpha, float endAlpha) {
    AnimationSet set = new AnimationSet(false);
    ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale,
            Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
    scale.setInterpolator(DECELERATE_QUINT);
    scale.setDuration(ANIM_DUR);
    set.addAnimation(scale);
    AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
    alpha.setInterpolator(DECELERATE_CUBIC);
    alpha.setDuration(ANIM_DUR);
    set.addAnimation(alpha);
    return set;
}
 
源代码20 项目: CodenameOne   文件: FragmentManager.java
static Animation makeOpenCloseAnimation(Context context, float startScale,
        float endScale, float startAlpha, float endAlpha) {
    AnimationSet set = new AnimationSet(false);
    ScaleAnimation scale = new ScaleAnimation(startScale, endScale, startScale, endScale,
            Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
    scale.setInterpolator(DECELERATE_QUINT);
    scale.setDuration(ANIM_DUR);
    set.addAnimation(scale);
    AlphaAnimation alpha = new AlphaAnimation(startAlpha, endAlpha);
    alpha.setInterpolator(DECELERATE_CUBIC);
    alpha.setDuration(ANIM_DUR);
    set.addAnimation(alpha);
    return set;
}