當前位置: 首頁>>代碼示例>>Java>>正文


Java ScaleAnimation類代碼示例

本文整理匯總了Java中android.view.animation.ScaleAnimation的典型用法代碼示例。如果您正苦於以下問題:Java ScaleAnimation類的具體用法?Java ScaleAnimation怎麽用?Java ScaleAnimation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ScaleAnimation類屬於android.view.animation包,在下文中一共展示了ScaleAnimation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: open

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
public void open() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(scaleAnimation);
        imageView.startAnimation(animationSet);


        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
 
開發者ID:ViewStub,項目名稱:ExpandButton,代碼行數:27,代碼來源:ExpandButtonLayout.java

示例2: startShowContinueIconAnimations

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
private AnimationSet startShowContinueIconAnimations() {
	Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
	Animation mRotateAnimation = new RotateAnimation(
				0, 360,
				Animation.RELATIVE_TO_SELF, 0.5f,
				Animation.RELATIVE_TO_SELF, 0.5f
	);
	mRotateAnimation.setRepeatCount(0);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
	mAnimations.setFillAfter(true);
	mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
	mAnimations.addAnimation(mScaleAnimation);
	mAnimations.addAnimation(mRotateAnimation);

	mContinueIcon.startAnimation(mAnimations);
	return mAnimations;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:20,代碼來源:WelcomeActivity.java

示例3: startHideContinueIconAnimations

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
private AnimationSet startHideContinueIconAnimations() {
	Animation mScaleAnimation = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
	Animation mRotateAnimation = new RotateAnimation(
				0, 360,
				Animation.RELATIVE_TO_SELF, 0.5f,
				Animation.RELATIVE_TO_SELF, 0.5f
	);
	mRotateAnimation.setRepeatCount(0);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
	mAnimations.setFillAfter(true);
	mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
	mAnimations.addAnimation(mScaleAnimation);
	mAnimations.addAnimation(mRotateAnimation);

	mContinueIcon.startAnimation(mAnimations);
	return mAnimations;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:20,代碼來源:WelcomeActivity.java

示例4: bindHelpButton

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
private void bindHelpButton() {
    titleHelpButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ScaleAnimation bounce = new ScaleAnimation(1.2f, 1f, 1.2f, 1, helpButtonSizePx / 2, helpButtonSizePx / 2);
            bounce.setDuration(600);
            bounce.setInterpolator(new BounceInterpolator());

            if (helpLayout.getVisibility() == View.GONE) {
                showHelpOverlay();
                titleHelpButton.setBackgroundResource(R.drawable.sr_close_icon);
                titleHelpButton.startAnimation(bounce);
            } else {
                hideHelpOverlay();
                titleHelpButton.setBackgroundResource(R.drawable.sr_info_icon);
                titleHelpButton.startAnimation(bounce);
            }
        }
    });
}
 
開發者ID:Ramotion,項目名稱:showroom-android,代碼行數:21,代碼來源:ShowroomActivity.java

示例5: getScaleAnimation

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
/**
 * 生成ScaleAnimation
 *
 * time=300
 */
public static Animation getScaleAnimation(float fromX,
                                      float toX,
                                      float fromY,
                                      float toY,
                                      int pivotXType,
                                      float pivotXValue,
                                      int pivotYType,
                                      float pivotYValue) {
    Animation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType,
                                                  pivotYValue
    );
    scaleAnimation.setDuration(300);
    scaleAnimation.setFillEnabled(true);
    scaleAnimation.setFillAfter(true);
    return scaleAnimation;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:SimpleAnimUtil.java

示例6: hide

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:20,代碼來源:Fab.java

示例7: display

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
public void display(float x) {
  this.startPositionX = x;
  this.lastPositionX  = x;

  recordButtonFab.setVisibility(View.VISIBLE);

  float translation = ViewCompat.getLayoutDirection(recordButtonFab) ==
      ViewCompat.LAYOUT_DIRECTION_LTR ? -.25f : .25f;

  AnimationSet animation = new AnimationSet(true);
  animation.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, translation,
                                                Animation.RELATIVE_TO_SELF, translation,
                                                Animation.RELATIVE_TO_SELF, -.25f,
                                                Animation.RELATIVE_TO_SELF, -.25f));

  animation.addAnimation(new ScaleAnimation(.5f, 1f, .5f, 1f,
                                            Animation.RELATIVE_TO_SELF, .5f,
                                            Animation.RELATIVE_TO_SELF, .5f));

  animation.setFillBefore(true);
  animation.setFillAfter(true);
  animation.setDuration(ANIMATION_DURATION);
  animation.setInterpolator(new OvershootInterpolator());

  recordButtonFab.startAnimation(animation);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:27,代碼來源:MicrophoneRecorderView.java

示例8: doEnterAnim

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
public void doEnterAnim(final View contentView, long animDuration) {
    if (builder.gravity == Gravity.BOTTOM) {
        ValueAnimator enterAnimator = ValueAnimator.ofFloat(contentView.getHeight(), 0);
        enterAnimator.setDuration(animDuration);
        enterAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float value = (float) animation.getAnimatedValue();
                contentView.setTranslationY(value);
            }
        });
        enterAnimator.start();
    } else {
        ScaleAnimation scaleAnimation = new ScaleAnimation(0F, 1.0F, 0F, 1.0F,
                Animation.RELATIVE_TO_PARENT, 0.5F, Animation.RELATIVE_TO_PARENT, 0.5F);
        scaleAnimation.setDuration(animDuration);
        scaleAnimation.setFillAfter(true);
        contentView.startAnimation(scaleAnimation);
    }
}
 
開發者ID:devilist,項目名稱:RecyclerWheelPicker,代碼行數:21,代碼來源:WheelPicker.java

示例9: doExitAnim

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
public void doExitAnim(final View contentView, long animDuration) {
    if (builder.gravity == Gravity.BOTTOM) {
        ValueAnimator exitAnimator = ValueAnimator.ofFloat(0, contentView.getHeight());
        exitAnimator.setDuration(animDuration);
        exitAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float value = (float) animation.getAnimatedValue();
                contentView.setTranslationY(value);
            }
        });
        exitAnimator.start();
    } else {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F,
                Animation.RELATIVE_TO_PARENT, 0.5F, Animation.RELATIVE_TO_PARENT, 0.5F);
        scaleAnimation.setDuration(animDuration);
        scaleAnimation.setFillAfter(true);
        contentView.startAnimation(scaleAnimation);
    }
}
 
開發者ID:devilist,項目名稱:RecyclerWheelPicker,代碼行數:21,代碼來源:WheelPicker.java

示例10: ScaleLoadingLayout

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
public ScaleLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
		super(context, mode, scrollDirection, attrs);
		/**創建縮放動畫動畫*/
		mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

//		mContentLayout.setSca(ScaleType.MATRIX);
//		mHeaderImageMatrix = new Matrix();
//		mHeaderImage.setImageMatrix(mHeaderImageMatrix);

		mScalAnimation = new ScaleAnimation(BASE_SCALE, 1, Animation.RELATIVE_TO_SELF, BASE_SCALE, Animation.RELATIVE_TO_SELF,
				1);
		mScalAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
		mScalAnimation.setDuration(ROTATION_ANIMATION_DURATION);
		mScalAnimation.setRepeatCount(Animation.INFINITE);
		mScalAnimation.setRepeatMode(Animation.RESTART);
	}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:17,代碼來源:ScaleLoadingLayout.java

示例11: onCreate

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.whats_door);
      
      mLeft = (ImageView)findViewById(R.id.imageLeft);
      mRight = (ImageView)findViewById(R.id.imageRight);
      mText = (TextView)findViewById(R.id.anim_text);
      
      AnimationSet anim = new AnimationSet(true);
TranslateAnimation mytranslateanim = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim.setDuration(2000);
anim.setStartOffset(800);
anim.addAnimation(mytranslateanim);
anim.setFillAfter(true);
mLeft.startAnimation(anim);

AnimationSet anim1 = new AnimationSet(true);
TranslateAnimation mytranslateanim1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim1.setDuration(1500);
anim1.addAnimation(mytranslateanim1);
anim1.setStartOffset(800);
anim1.setFillAfter(true);
mRight.startAnimation(anim1);

AnimationSet anim2 = new AnimationSet(true);
ScaleAnimation myscaleanim = new ScaleAnimation(1f,3f,1f,3f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
myscaleanim.setDuration(1000);
AlphaAnimation myalphaanim = new AlphaAnimation(1,0.0001f);
myalphaanim.setDuration(1500);
anim2.addAnimation(myscaleanim);
anim2.addAnimation(myalphaanim);
anim2.setFillAfter(true);
mText.startAnimation(anim2);
new Thread(this).start();
  }
 
開發者ID:qizhenghao,項目名稱:HiBangClient,代碼行數:37,代碼來源:WhatsnewDoor.java

示例12: onSuccess

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
protected void onSuccess() {
    mCardView.removeAllViews();
    MediaPlayer.create(mContext, R.raw.shake).start();
    initShakeView();
    mCardView.addView(mShakeView);
    mCardView.setVisibility(View.VISIBLE);
    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(320);
    animation.setFillAfter(true);
    mCardView.startAnimation(animation);

    mLoadingView.stop();
    mLoadingView.setVisibility(View.GONE);
    mTvState.setVisibility(View.GONE);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:17,代碼來源:BaseSensorFragment.java

示例13: close

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
public void close() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(360, 270,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(scaleAnimation);
        imageView.startAnimation(animationSet);
        AnimatorSet animatorSet = new AnimatorSet();
        ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", mLinearLayoutWidth, 0);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", savePaddingLeft, 0);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", savePaddingRight, 0);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", saveMarginLeft, 0);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", saveMarginRight, 0);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
 
開發者ID:ViewStub,項目名稱:ExpandButton,代碼行數:25,代碼來源:ExpandButtonLayout.java

示例14: onCreate

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
@Override
@SuppressLint("SetJavaScriptEnabled")
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);
    WebView webView = (WebView) findViewById(R.id.web_view);
    String url = getIntent().getStringExtra(URL);
    if (url == null && getIntent().getData() != null) {
        url = getIntent().getData().getQueryParameter(URL);
    }
    if (url == null) {
        finish();
    }
    webView.setWebViewClient(new InnerWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);

    loading = (TextView) findViewById(R.id.loading);
    Animation animation = new ScaleAnimation(1.0f, 1.2f, 1.0f, 1.2f,
        Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setDuration(500);
    loading.startAnimation(animation);
    setTitle(url);
}
 
開發者ID:drakeet,項目名稱:Floo,代碼行數:27,代碼來源:WebActivity.java

示例15: scaleSmallAnim

import android.view.animation.ScaleAnimation; //導入依賴的package包/類
private Animation scaleSmallAnim(int duration, final View child) {

        AnimationSet animationSet = new AnimationSet(true);

        ScaleAnimation scaleAnim = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                0.5f);
        AlphaAnimation alphaAnim = new AlphaAnimation(1f, 0.0f);
        alphaAnim.setFillAfter(true);
        animationSet.addAnimation(scaleAnim);
        animationSet.addAnimation(alphaAnim);
        animationSet.setDuration(duration);

        return animationSet;

    }
 
開發者ID:Ethan-9606,項目名稱:BottomMenu,代碼行數:17,代碼來源:BottomMenu.java


注:本文中的android.view.animation.ScaleAnimation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。