当前位置: 首页>>代码示例>>Java>>正文


Java Transformation类代码示例

本文整理汇总了Java中android.view.animation.Transformation的典型用法代码示例。如果您正苦于以下问题:Java Transformation类的具体用法?Java Transformation怎么用?Java Transformation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Transformation类属于android.view.animation包,在下文中一共展示了Transformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateLineLTRAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
private Animation generateLineLTRAnimation(final RectF rectF, long offset) {

		final float currentLeft = rectF.left;
		final float currentRight = rectF.right;

		Animation animation = new Animation() {
			@Override
			protected void applyTransformation(float interpolatedTime, Transformation t) {
				super.applyTransformation(interpolatedTime, t);
				if (getCurrentState() == HBButtonState.NORMAL) {
					rectF.set(rectF.left, rectF.top, currentRight - (currentRight - currentLeft) / 2 * interpolatedTime, rectF.bottom);
				} else {
					rectF.set(rectF.left, rectF.top, currentRight + (currentRight - currentLeft) * interpolatedTime, rectF.bottom);
				}
				invalidate();
			}
		};
		animation.setDuration(getAnimationDuration());
		animation.setStartOffset(offset);
		return animation;
	}
 
开发者ID:LongDinhF,项目名称:Hamburger-Button,代码行数:22,代码来源:HBButton.java

示例2: generateLineRTLAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {

		final float currentLeft = rectF.left;
		final float currentRight = rectF.right;

		Animation animation = new Animation() {
			@Override
			protected void applyTransformation(float interpolatedTime, Transformation t) {
				super.applyTransformation(interpolatedTime, t);
				if (getCurrentState() == HBButtonState.NORMAL) {
					rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
				} else {
					rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
				}
				invalidate();
			}
		};
		animation.setDuration(getAnimationDuration());
		animation.setStartOffset(offset);
		return animation;
	}
 
开发者ID:LongDinhF,项目名称:Hamburger-Button,代码行数:22,代码来源:HBButton.java

示例3: applyTransformation

import android.view.animation.Transformation; //导入依赖的package包/类
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
    int targetTop = 0;
    int endTarget = 0;
    if (!mUsingCustomStart) {
        switch (mDirection) {
            case BOTTOM:
                endTarget = getMeasuredHeight() - (int) (mSpinnerFinalOffset);
                break;
            case TOP:
            default:
                endTarget = (int) (mSpinnerFinalOffset - Math.abs(mOriginalOffsetTop));
                break;
        }
    } else {
        endTarget = (int) mSpinnerFinalOffset;
    }
    targetTop = (mFrom + (int) ((endTarget - mFrom) * interpolatedTime));
    int offset = targetTop - mCircleView.getTop();
    setTargetOffsetTopAndBottom(offset, false /* requires update */);
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:22,代码来源:SwipeRefreshLayout.java

示例4: transformImageBitmap

import android.view.animation.Transformation; //导入依赖的package包/类
private void transformImageBitmap(View child, Transformation t,
                                  int rotationAngle) {
    mCamera.save();
    final Matrix imageMatrix = t.getMatrix();
    final int imageHeight = child.getLayoutParams().height;
    final int imageWidth = child.getLayoutParams().width;
    final int rotation = Math.abs(rotationAngle);

    mCamera.translate(0.0f, 0.0f, 100.0f);

    // As the angle of the view gets less, zoom in
    if (rotation < mMaxRotationAngle) {
        float zoomAmount = (float) (mMaxZoom + (rotation * 1.5));
        mCamera.translate(0.0f, 0.0f, zoomAmount);
    }

    mCamera.rotateY(rotationAngle);
    mCamera.getMatrix(imageMatrix);
    imageMatrix.preTranslate(-(imageWidth / 2), -(imageHeight / 2));
    imageMatrix.postTranslate((imageWidth / 2), (imageHeight / 2));
    mCamera.restore();
}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:23,代码来源:CourseInfoGallery.java

示例5: applyTransformation

import android.view.animation.Transformation; //导入依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final Matrix matrix = t.getMatrix();

    mCamera.save();
    switch (mRollType) {
        case ROLL_BY_X:
            mCamera.rotateX(degrees);
            break;
        case ROLL_BY_Y:
            mCamera.rotateY(degrees);
            break;
        case ROLL_BY_Z:
            mCamera.rotateZ(degrees);
            break;
    }
    mCamera.getMatrix(matrix);
    mCamera.restore();

    matrix.preTranslate(-mPivotX, -mPivotY);
    matrix.postTranslate(mPivotX, mPivotY);
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:26,代码来源:Rotate3dAnimation.java

示例6: startScaleDownReturnToStartAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
@SuppressLint("NewApi")
private void startScaleDownReturnToStartAnimation(Animation.AnimationListener listener) {
    mStartingScale = mRefreshView.getScaleX();
    mScaleDownToStartAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            float targetScale = (mStartingScale + (-mStartingScale * interpolatedTime));
            setAnimationProgress(targetScale);
            moveToStart(interpolatedTime);
        }
    };
    mScaleDownToStartAnimation.setDuration(SCALE_DOWN_DURATION);
    if (listener != null) {
        mScaleDownToStartAnimation.setAnimationListener(listener);
    }
    mRefreshView.clearAnimation();
    mRefreshView.startAnimation(mScaleDownToStartAnimation);
}
 
开发者ID:yangjiantao,项目名称:AndroidUiKit,代码行数:19,代码来源:ISwipeRefreshLayout.java

示例7: startScaleDownReturnToStartAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
private void startScaleDownReturnToStartAnimation(int from,
        Animation.AnimationListener listener) {
    mFrom = from;
    if (isAlphaUsedForScale()) {
        mStartingScale = mProgress.getAlpha();
    } else {
        mStartingScale = ViewCompat.getScaleX(mCircleView);
    }
    mScaleDownToStartAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            float targetScale = (mStartingScale + (-mStartingScale  * interpolatedTime));
            setAnimationProgress(targetScale);
            moveToStart(interpolatedTime);
        }
    };
    mScaleDownToStartAnimation.setDuration(SCALE_DOWN_DURATION);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mScaleDownToStartAnimation);
}
 
开发者ID:unixzii,项目名称:android-source-codes,代码行数:24,代码来源:SwipeRefreshLayout.java

示例8: startAlphaAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    // Pre API 11, alpha is used in place of scale. Don't also use it to
    // show the trigger point.
    if (mScale && isAlphaUsedForScale()) {
        return null;
    }
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mProgress
                    .setAlpha((int) (startingAlpha+ ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mCircleView.setAnimationListener(null);
    mCircleView.clearAnimation();
    mCircleView.startAnimation(alpha);
    return alpha;
}
 
开发者ID:zwmlibs,项目名称:BookReader-master,代码行数:22,代码来源:SwipeRefreshLayout.java

示例9: startAlphaAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
    // Pre API 11, alpha is used in place of scale. Don't also use it to
    // show the trigger point.
    if (mScale && isAlphaUsedForScale()) {
        return null;
    }
    Animation alpha = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            mProgress
                    .setAlpha((int) (startingAlpha + ((endingAlpha - startingAlpha)
                            * interpolatedTime)));
        }
    };
    alpha.setDuration(ALPHA_ANIMATION_DURATION);
    // Clear out the previous animation listeners.
    mCircleView.setAnimationListener(null);
    mCircleView.clearAnimation();
    mCircleView.startAnimation(alpha);
    return alpha;
}
 
开发者ID:aliumujib,项目名称:SwipeToRefresh,代码行数:22,代码来源:SwipeToRefreshLayout.java

示例10: applyTransformation

import android.view.animation.Transformation; //导入依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float degrees = mFromDegrees + ((mToDegrees - mFromDegrees) * interpolatedTime);
    if (mPivotX == 0.0f && mPivotY == 0.0f) {
        t.getMatrix().setRotate(degrees);
    } else {
        t.getMatrix().setRotate(degrees, mPivotX, mPivotY);
    }

    float dx = mFromXDelta;
    float dy = mFromYDelta;
    if (mFromXDelta != mToXDelta) {
        dx = mFromXDelta + ((mToXDelta - mFromXDelta) * interpolatedTime);
    }
    if (mFromYDelta != mToYDelta) {
        dy = mFromYDelta + ((mToYDelta - mFromYDelta) * interpolatedTime);
    }

    t.getMatrix().postTranslate(dx, dy);
}
 
开发者ID:cheenid,项目名称:FLFloatingButton,代码行数:21,代码来源:RotateAndTranslateAnimation.java

示例11: applyTransformation

import android.view.animation.Transformation; //导入依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final double radians = Math.PI * interpolatedTime;
    float degrees = (float) (180.0 * radians / Math.PI);

    if (interpolatedTime >= 0.5f) { // Alternate the visibility of views at the exact half of animation duration.
        degrees -= 180.f;
        fromView.setVisibility(View.GONE);
        toView.setVisibility(View.VISIBLE);
    }

    if (forward)
        degrees = -degrees;

    final Matrix matrix = t.getMatrix();
    camera.save();
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:riteshakya037,项目名称:Flashcards-Demo,代码行数:23,代码来源:FlipAnimation.java

示例12: startScaleUpAnimation

import android.view.animation.Transformation; //导入依赖的package包/类
private void startScaleUpAnimation(AnimationListener listener) {
    mHeadViewContainer.setVisibility(View.VISIBLE);
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime,
                                        Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mHeadViewContainer.setAnimationListener(listener);
    }
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mScaleAnimation);
}
 
开发者ID:GaoGersy,项目名称:MultiSelecter,代码行数:17,代码来源:SuperSwipeRefreshLayout.java

示例13: expand

import android.view.animation.Transformation; //导入依赖的package包/类
public void expand() {
    if (!isExpand) {
        isExpand = true;
        mText.setTextColor(Color.TRANSPARENT);
        mExpandText.setTextColor(mTextColor);
        Animation animation = new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                ViewGroup.LayoutParams params = ExpandTextView.this.getLayoutParams();
                params.height = mStart + (int) ((mEnd - mStart) * interpolatedTime);
                setLayoutParams(params);
            }
        };
        animation.setDuration(500);
        startAnimation(animation);
    }

}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:19,代码来源:ExpandTextView.java

示例14: applyTransformation

import android.view.animation.Transformation; //导入依赖的package包/类
@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    Camera camera = new Camera();
    camera.save();

    // 设置camera动作为绕Y轴旋转
    // 总共旋转180度,因此计算在每个补间时间点interpolatedTime的角度即为两着相乘
//    camera.rotateX(deg * interpolatedTime);
    camera.rotateY(180 * interpolatedTime);
//    camera.rotateZ(180 * interpolatedTime);
//
    // 根据camera动作产生一个matrix,赋给Transformation的matrix,以用来设置动画效果
    Matrix matrix = t.getMatrix();
    camera.getMatrix(matrix);

    camera.restore();
    //经过以下平移,才能以view的中心点进行翻转
    matrix.preTranslate(-view.getWidth() / 2, -view.getHeight() / 2);
    matrix.postTranslate(view.getWidth() / 2, view.getHeight() / 2);
  }
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:21,代码来源:Rotate3d.java

示例15: applyTransformation

import android.view.animation.Transformation; //导入依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {

    mAnimRect.left = mStartCropWindowRect.left + (mEndCropWindowRect.left - mStartCropWindowRect.left) * interpolatedTime;
    mAnimRect.top = mStartCropWindowRect.top + (mEndCropWindowRect.top - mStartCropWindowRect.top) * interpolatedTime;
    mAnimRect.right = mStartCropWindowRect.right + (mEndCropWindowRect.right - mStartCropWindowRect.right) * interpolatedTime;
    mAnimRect.bottom = mStartCropWindowRect.bottom + (mEndCropWindowRect.bottom - mStartCropWindowRect.bottom) * interpolatedTime;
    mCropOverlayView.setCropWindowRect(mAnimRect);

    for (int i = 0; i < mAnimPoints.length; i++) {
        mAnimPoints[i] = mStartBoundPoints[i] + (mEndBoundPoints[i] - mStartBoundPoints[i]) * interpolatedTime;
    }
    mCropOverlayView.setBounds(mAnimPoints, mImageView.getWidth(), mImageView.getHeight());

    for (int i = 0; i < mAnimMatrix.length; i++) {
        mAnimMatrix[i] = mStartImageMatrix[i] + (mEndImageMatrix[i] - mStartImageMatrix[i]) * interpolatedTime;
    }
    Matrix m = mImageView.getImageMatrix();
    m.setValues(mAnimMatrix);
    mImageView.setImageMatrix(m);

    mImageView.invalidate();
    mCropOverlayView.invalidate();
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:25,代码来源:CropImageAnimation.java


注:本文中的android.view.animation.Transformation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。