RELATIVE_TO_SELF源码实例Demo

android.view.animation.ScaleAnimation#RELATIVE_TO_SELF源码实例Demo

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

源代码1 项目: AndroidPlusJava   文件: AboutActivity.java
private void startAnimation() {
    AnimationSet animationSet = new AnimationSet(true);
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);

    ScaleAnimation scaleAnimation = new ScaleAnimation(1.5f, 1, 1.5f, 1,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);

    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);

    animationSet.addAnimation(rotateAnimation);
    animationSet.addAnimation(scaleAnimation);
    animationSet.addAnimation(alphaAnimation);
    animationSet.setDuration(2000);
    mAboutInfo.startAnimation(animationSet);
}
 
源代码2 项目: RippleImageView   文件: RippleImageView.java
/**
 * 初始化动画集
 * @return
 */
private AnimationSet initAnimationSet() {
    AnimationSet as = new AnimationSet(true);
    //缩放度:变大两倍
    ScaleAnimation sa = new ScaleAnimation(1f, 2f, 1f, 2f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    sa.setDuration(show_spacing_time * 3);
    sa.setRepeatCount(Animation.INFINITE);// 设置循环
    //透明度
    AlphaAnimation aa = new AlphaAnimation(1, 0.1f);
    aa.setDuration(show_spacing_time * 3);
    aa.setRepeatCount(Animation.INFINITE);//设置循环
    as.addAnimation(sa);
    as.addAnimation(aa);
    return as;
}
 
源代码3 项目: DevUtils   文件: AnimationUtils.java
/**
 * 获取一个中心点缩放动画
 * @param fromX             动画开始前在 X 坐标
 * @param toX               动画结束后在 X 坐标
 * @param fromY             动画开始前在 Y 坐标
 * @param toY               动画结束后在 Y 坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个中心点缩放动画
 */
public static ScaleAnimation getScaleAnimationCenter(final float fromX, final float toX, final float fromY, final float toY,
                                                     final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
源代码4 项目: DevUtils   文件: AnimationUtils.java
/**
 * 获取一个缩小动画
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个缩小动画
 */
public static ScaleAnimation getLessenScaleAnimation(final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
            ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
源代码5 项目: DevUtils   文件: AnimationUtils.java
/**
 * 获取一个放大动画
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个放大动画
 */
public static ScaleAnimation getAmplificationAnimation(final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
            ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
源代码6 项目: SprintNBA   文件: AnimationUtils.java
/**
 * 获取一个缩小动画
 *
 * @param durationMillis    时间
 * @param animationListener 监听
 * @return 一个缩小动画
 */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, Animation.AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f,
            0.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);

    return scaleAnimation;
}
 
源代码7 项目: SprintNBA   文件: AnimationUtils.java
/**
 * 获取一个放大动画
 *
 * @param durationMillis    时间
 * @param animationListener 监听
 * @return 返回一个放大的效果
 */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, Animation.AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f,
            1.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
 
源代码8 项目: Study_Android_Demo   文件: MainActivity.java
public void scaleAnim_java(View view) {
	// 2.����һ��ScaleAnimation����
	ScaleAnimation animation = new ScaleAnimation(1f, 3f, 1f, 3f,
			ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
			ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
	// ����ʱ��
	animation.setDuration(1000);
	// ����ֹͣ�����һ֡
	animation.setFillAfter(true);
	// 3.���Ŷ���
	iv_rocket.startAnimation(animation);

}
 
源代码9 项目: Study_Android_Demo   文件: MainActivity.java
public void setAnim_java(View view) {
	// 2.����һ��AnimationSet
	AnimationSet set = new AnimationSet(true);
	// 3.������������:ƽ�ơ���ת�����š�͸��
			// 2.����TranslateAnimation
	TranslateAnimation trans = new TranslateAnimation(
			TranslateAnimation.RELATIVE_TO_PARENT, 0,
			TranslateAnimation.RELATIVE_TO_PARENT, 0,
			TranslateAnimation.RELATIVE_TO_PARENT, 0,
			TranslateAnimation.RELATIVE_TO_PARENT, -1f);
	// 2.����ScaleAnimation
	ScaleAnimation scale = new ScaleAnimation(1f, 0.6f, 1f, 0.6f,
			ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
			ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
	// 4.ͨ��set.addAnimtion()
	set.addAnimation(trans);
	set.addAnimation(scale);
	// ��ֵ��
	set.setInterpolator(new AccelerateInterpolator());
	// ����ʱ��
	set.setDuration(2000);
	// ����ֹͣ�����
	set.setFillAfter(true);
	// 5.���Ŷ���
	iv_rocket.startAnimation(set);

}
 
源代码10 项目: Utils   文件: CustomAnim.java
/**
 * get a lessen scale animation
 *
 * @param durationMillis Duration in milliseconds
 * @param listener       the animation listener to be notified
 * @return An animation that controls the lessen scale of an object
 */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, Animation.AnimationListener listener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f,
            0.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(listener);
    return scaleAnimation;
}
 
源代码11 项目: Utils   文件: CustomAnim.java
/**
 * get a amplification scale animation
 *
 * @param durationMillis Duration in milliseconds
 * @param listener       the animation listener to be notified
 * @return An animation that controls the amplification scale of an object
 */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, Animation.AnimationListener listener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f,
            1.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(listener);
    return scaleAnimation;
}
 
源代码12 项目: AndroidStudyDemo   文件: AnimationUtil.java
/**
 * 获取一个缩小动画
 *
 * @param durationMillis
 * @param animationListener
 * @return
 */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
 
源代码13 项目: AndroidStudyDemo   文件: AnimationUtil.java
/**
 * 获取一个放大动画
 *
 * @param durationMillis
 * @param animationListener
 * @return
 */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
 
源代码14 项目: maps.android   文件: NMapCalloutOverlayView.java
private void animateCallout() {

		// Create a scale animation
		ScaleAnimation animation = new ScaleAnimation(0.5f, 1.0f, 0.5f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
			ScaleAnimation.RELATIVE_TO_SELF, 1.0f);

		animation.setDuration(SCALE_DURATION_MILLS);

		this.startAnimation(animation);
	}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。