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


Java Animation.RELATIVE_TO_SELF屬性代碼示例

本文整理匯總了Java中android.view.animation.Animation.RELATIVE_TO_SELF屬性的典型用法代碼示例。如果您正苦於以下問題:Java Animation.RELATIVE_TO_SELF屬性的具體用法?Java Animation.RELATIVE_TO_SELF怎麽用?Java Animation.RELATIVE_TO_SELF使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.animation.Animation的用法示例。


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

示例1: moveTo

public void moveTo(float x) {
  this.lastPositionX = x;

  float offset          = getOffset(x);
  int   widthAdjustment = getWidthAdjustment();

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, widthAdjustment + offset,
                                                        Animation.ABSOLUTE, widthAdjustment + offset,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  translateAnimation.setDuration(0);
  translateAnimation.setFillAfter(true);
  translateAnimation.setFillBefore(true);

  recordButtonFab.startAnimation(translateAnimation);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:17,代碼來源:MicrophoneRecorderView.java

示例2: FlipLoadingLayout

public FlipLoadingLayout(Context context, final Mode mode, final Orientation scrollDirection, TypedArray attrs) {
	super(context, mode, scrollDirection, attrs);

	final int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180;

	mRotateAnimation = new RotateAnimation(0, rotateAngle, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
	mResetRotateAnimation.setDuration(FLIP_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:17,代碼來源:FlipLoadingLayout.java

示例3: translateAlphaFinishAnimation

/**
 * 結束時的動畫 平移到底部
 */
public static Animation translateAlphaFinishAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
    setDefaultConfig(translateAnimation, true);
    setDefaultConfig(alphaAnimation, true);

    translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);
    alphaAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(alphaAnimation);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:18,代碼來源:AnimUtil.java

示例4: createShrinkAnimation

private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
		long startOffset, long duration, Interpolator interpolator) {
	AnimationSet animationSet = new AnimationSet(false);
	animationSet.setFillAfter(true);

	final long preDuration = duration / 2;
	Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	rotateAnimation.setStartOffset(startOffset);
	rotateAnimation.setDuration(preDuration);
	rotateAnimation.setInterpolator(new LinearInterpolator());
	rotateAnimation.setFillAfter(true);

	animationSet.addAnimation(rotateAnimation);

	Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
	translateAnimation.setStartOffset(startOffset + preDuration);
	translateAnimation.setDuration(duration - preDuration);
	translateAnimation.setInterpolator(interpolator);
	translateAnimation.setFillAfter(true);

	animationSet.addAnimation(translateAnimation);

	return animationSet;
}
 
開發者ID:cheenid,項目名稱:FLFloatingButton,代碼行數:25,代碼來源:RayLayout.java

示例5: initAnims

private void initAnims() {
	animShow = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 1,
			Animation.RELATIVE_TO_SELF, 0);
	animShow.setDuration(300);

	animHide = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 1);
	animHide.setDuration(300);
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:15,代碼來源:PlatformPage.java

示例6: rotateAnimation

public static Animation rotateAnimation(boolean circle /*循環動畫*/) {
    RotateAnimation animation = new RotateAnimation(0f, 360f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setInterpolator(new LinearInterpolator());
    animation.setDuration(300);

    if (circle) {
        animation.setRepeatCount(Animation.INFINITE);
        animation.setRepeatMode(Animation.RESTART);
        animation.setDuration(2000);
    }
    return animation;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:13,代碼來源:AnimUtil.java

示例7: reloadQuestionnaire

@Override
public void reloadQuestionnaire(List<Question> questionList) {
    refreshQuestionnaire(questionList);
    ScaleAnimation animation =
            new ScaleAnimation(
                    1.15f, 1, 1.15f, 1,
                    Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);

    mCardsContainerView.setAnimation(animation);
    animation.setDuration(100);
    animation.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:MainActivity.java

示例8: translateFinishAnimation

/**
 * 結束時的動畫 平移到底部
 */
public static Animation translateFinishAnimation() {
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f);
    setDefaultConfig(translateAnimation, true);

    translateAnimation.setDuration(DEFAULT_DIALOG_FINISH_ANIM_TIME);

    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:14,代碼來源:AnimUtil.java

示例9: startRotate

/**
     * rotate
     */
    private void startRotate() {
        RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
        rotate.setDuration(1000);
//        rotate.setRepeatMode(Animation.REVERSE);
        rotate.setRepeatMode(Animation.RESTART);
        rotate.setRepeatCount(Animation.INFINITE);
        content.startAnimation(rotate);
    }
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:11,代碼來源:AnimationDemoActivity.java

示例10: rotateImage

public void rotateImage(ImageView imageView)
{
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360f,
            Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);

    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setDuration(1000);
    rotateAnimation.setRepeatCount(Animation.INFINITE);

    imageView.startAnimation(rotateAnimation);
}
 
開發者ID:jbmlaird,項目名稱:DiscogsBrowser,代碼行數:12,代碼來源:ImageViewAnimator.java

示例11: moveTo

public void moveTo(float x) {
  float     offset    = getOffset(x);
  Animation animation = new TranslateAnimation(Animation.ABSOLUTE, offset,
                                               Animation.ABSOLUTE, offset,
                                               Animation.RELATIVE_TO_SELF, 0,
                                               Animation.RELATIVE_TO_SELF, 0);

  animation.setDuration(0);
  animation.setFillAfter(true);
  animation.setFillBefore(true);

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

示例12: addLoopScaleAnimations

private void addLoopScaleAnimations(long duration, AnimationSet set) {
    ScaleAnimation mScaleAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mScaleAnim.setDuration(duration);
    set.addAnimation(mScaleAnim);
    ScaleAnimation mScaleDownAnim = new ScaleAnimation(SCALE_AMOUNT, 1, SCALE_AMOUNT, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mScaleDownAnim.setDuration(duration);
    mScaleDownAnim.setStartOffset(duration + 50);
    set.addAnimation(mScaleDownAnim);
    set.setInterpolator(interpolator);
}
 
開發者ID:HarinTrivedi,項目名稱:AnimatedPullToRefresh-master,代碼行數:10,代碼來源:AnimationHelper.java

示例13: hide

public void hide(float x) {
  this.lastPositionX = x;

  float offset          = getOffset(x);
  int   widthAdjustment = getWidthAdjustment();

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
                                                        Animation.ABSOLUTE, widthAdjustment,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setFillBefore(true);
  animation.setFillAfter(false);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:29,代碼來源:MicrophoneRecorderView.java

示例14: initShowAnimation

@Override
protected Animation initShowAnimation() {
    AnimationSet set=new AnimationSet(false);
    Animation shakeAnima=new RotateAnimation(0,15,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    shakeAnima.setInterpolator(new CycleInterpolator(5));
    shakeAnima.setDuration(400);
    set.addAnimation(getDefaultAlphaAnimation());
    set.addAnimation(shakeAnima);
    return set;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:DialogPopup.java

示例15: getDefaultScaleAnimation

/**
 * 生成自定義ScaleAnimation
 */
public static Animation getDefaultScaleAnimation() {
    Animation scaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f,
                                                  Animation.RELATIVE_TO_SELF, 0.5f
    );
    scaleAnimation.setDuration(300);
    scaleAnimation.setInterpolator(new AccelerateInterpolator());
    scaleAnimation.setFillEnabled(true);
    scaleAnimation.setFillAfter(true);
    return scaleAnimation;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:SimpleAnimUtil.java


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