当前位置: 首页>>代码示例>>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;未经允许,请勿转载。