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


Java View.setRotationX方法代码示例

本文整理汇总了Java中android.view.View.setRotationX方法的典型用法代码示例。如果您正苦于以下问题:Java View.setRotationX方法的具体用法?Java View.setRotationX怎么用?Java View.setRotationX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


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

示例1: onPreTransform

import android.view.View; //导入方法依赖的package包/类
protected void onPreTransform(View page, float position) {
    float f = 0.0f;
    float width = (float) page.getWidth();
    page.setRotationX(0.0f);
    page.setRotationY(0.0f);
    page.setRotation(0.0f);
    page.setScaleX(1.0f);
    page.setScaleY(1.0f);
    page.setPivotX(0.0f);
    page.setPivotY(0.0f);
    page.setTranslationY(0.0f);
    page.setTranslationX(isPagingEnabled() ? 0.0f : (-width) * position);
    if (hideOffscreenPages()) {
        if (position > -1.0f && position < 1.0f) {
            f = 1.0f;
        }
        page.setAlpha(f);
        return;
    }
    page.setAlpha(1.0f);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:ABaseTransformer.java

示例2: onPreTransform

import android.view.View; //导入方法依赖的package包/类
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <p>
 * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
 * not modify the same page properties. For instance changing from a transformation that applies rotation to a
 * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
 * alpha.
 * 
 * @param page
 *            Apply the transformation to this page
 * @param position
 *            Position of page relative to the current front-and-center position of the pager. 0 is front and
 *            center. 1 is one full page position to the right, and -1 is one page position to the left.
 */
protected void onPreTransform(View page, float position) {
	final float width = page.getWidth();

	page.setRotationX(0);
	page.setRotationY(0);
	page.setRotation(0);
	page.setScaleX(1);
	page.setScaleY(1);
	page.setPivotX(0);
	page.setPivotY(0);
	page.setTranslationY(0);
	page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

	if (hideOffscreenPages()) {
		page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
		page.setEnabled(false);
	} else {
		page.setEnabled(true);
		page.setAlpha(1f);
	}
}
 
开发者ID:maning0303,项目名称:MNImageBrowser,代码行数:36,代码来源:ABaseTransformer.java

示例3: onPreTransform

import android.view.View; //导入方法依赖的package包/类
/**
	 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
	 * <p>
	 * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
	 * not modify the same page properties. For instance changing from a transformation that applies rotation to a
	 * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
	 * alpha.
	 *
	 * @param page
	 *            Apply the transformation to this page
	 * @param position
	 *            Position of page relative to the current front-and-center position of the pager. 0 is front and
	 *            center. 1 is one full page position to the right, and -1 is one page position to the left.
	 */
	protected void onPreTransform(View page, float position) {
		final float width = page.getWidth();

		page.setRotationX(0);
		page.setRotationY(0);
		page.setRotation(0);
		page.setScaleX(1);
		page.setScaleY(1);
		page.setPivotX(0);
		page.setPivotY(0);
		page.setTranslationY(0);
		page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

		if (hideOffscreenPages()) {
			page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
//			page.setEnabled(false);
		} else {
//			page.setEnabled(true);
			page.setAlpha(1f);
		}
	}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:ABaseTransformer.java

示例4: onPreTransform

import android.view.View; //导入方法依赖的package包/类
/**
 * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View, float)}.
 * <p>
 * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
 * not modify the same page properties. For instance changing from a transformation that applies rotation to a
 * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
 * alpha.
 * 
 * @param page
 *            Apply the transformation to this page
 * @param position
 *            Position of page relative to the current front-and-center position of the pager. 0 is front and
 *            center. 1 is one full page position to the right, and -1 is one page position to the left.
 */
protected void onPreTransform(View page, float position) {
	final float width = page.getWidth();

	page.setRotationX(0);
	page.setRotationY(0);
	page.setRotation(0);
	page.setScaleX(1);
	page.setScaleY(1);
	page.setPivotX(0);
	page.setPivotY(0);
	page.setTranslationY(0);
	page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

	if (hideOffscreenPages()) {
		page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
	} else {
		page.setAlpha(1f);
	}
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:34,代码来源:ABaseTransformer.java

示例5: onAnimationEnd

import android.view.View; //导入方法依赖的package包/类
@Override
public void onAnimationEnd(Animator animation)
{
    super.onAnimationEnd(animation);

    final View target = getTarget();
    if (target != null)
    {
        target.setAlpha(1.0f);
        target.setRotation(0.0f);
        target.setRotationX(0.0f);
        target.setRotationY(0.0f);
        target.setTranslationX(0.0f);
        target.setTranslationY(0.0f);
        target.setScaleX(1.0f);
        target.setScaleY(1.0f);
    }
}
 
开发者ID:zj565061763,项目名称:animator,代码行数:19,代码来源:OnEndReset.java

示例6: onTransform

import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
	final float rotation = -180f * position;

	view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
	view.setPivotX(view.getWidth() * 0.5f);
	view.setPivotY(view.getHeight() * 0.5f);
	view.setRotationX(rotation);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:FlipVerticalTransformer.java

示例7: clearAnimation

import android.view.View; //导入方法依赖的package包/类
public static void clearAnimation(View view) {
    view.setAlpha(1);
    view.setScaleX(1);
    view.setScaleY(1);
    view.setTranslationX(0);
    view.setTranslationY(0);
    view.setRotation(0);
    view.setRotationX(0);
    view.setRotationY(0);
}
 
开发者ID:Appolica,项目名称:Flubber,代码行数:11,代码来源:FlubberUtil.java

示例8: setRotationX

import android.view.View; //导入方法依赖的package包/类
public void setRotationX(View view, float rotationX) {
    if (View10.NEED_PROXY) {
        View10.wrap(view).setRotationX(rotationX);
    } else {
        view.setRotationX(rotationX);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:8,代码来源:ViewProxy.java

示例9: resetTransformProperty

import android.view.View; //导入方法依赖的package包/类
private static void resetTransformProperty(View view) {
  view.setTranslationX(PixelUtil.toPixelFromDIP(0));
  view.setTranslationY(PixelUtil.toPixelFromDIP(0));
  view.setRotation(0);
  view.setRotationX(0);
  view.setRotationY(0);
  view.setScaleX(1);
  view.setScaleY(1);
  view.setCameraDistance(0);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:11,代码来源:BaseViewManager.java

示例10: updateViewWithPercent

import android.view.View; //导入方法依赖的package包/类
/** 更新View */
public void updateViewWithPercent(View child, float percent) {
    if (mAnimation == null) {
        //如果没有自定义动画,那么使用属性动画
        float newX = targetX == UNSPECIFIED_INT ? 0 : (targetX - mStartX) * percent;
        float newY = targetY == UNSPECIFIED_INT ? 0 : (targetY - mStartY) * percent;
        //缩放动画
        if (targetWidth != UNSPECIFIED_INT || targetHeight != UNSPECIFIED_INT) {
            child.setScaleX(scaleEvaluator(mStartWidth, targetWidth, percent));
            child.setScaleY(scaleEvaluator(mStartHeight, targetHeight, percent));
            float newWidth = floatEvaluator(mStartWidth, targetWidth, percent);
            float newHeight = floatEvaluator(mStartWidth, targetWidth, percent);
            newX -= (mStartWidth - newWidth) / 2;
            newY -= (mStartHeight - newHeight) / 2;
        }
        //平移动画
        child.setTranslationX(newX);
        child.setTranslationY(newY);
        //透明度变化
        if (targetAlpha != UNSPECIFIED_FLOAT) child.setAlpha(floatEvaluator(mStartAlpha, targetAlpha, percent));
        //背景渐变
        if (targetBackgroundColor != UNSPECIFIED_INT && mStartBackgroundColor != 0) {
            child.setBackgroundColor(argbEvaluator(mStartBackgroundColor, targetBackgroundColor, percent));
        }
        //旋转动画
        if (targetRotateX != UNSPECIFIED_FLOAT) child.setRotationX(floatEvaluator(mStartRotateX, targetRotateX, percent));
        if (targetRotateY != UNSPECIFIED_FLOAT) child.setRotationY(floatEvaluator(mStartRotateY, targetRotateY, percent));
    } else {
        mAnimation.setStartTime(0);
        mAnimation.restrictDuration(100);
        Transformation transformation = new Transformation();
        mAnimation.getTransformation((long) (percent * 100), transformation);
        BehaviorAnimation animation = new BehaviorAnimation(transformation);
        child.startAnimation(animation);
    }
    child.requestLayout();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:38,代码来源:SimpleViewBehavior.java

示例11: setValue

import android.view.View; //导入方法依赖的package包/类
/**
 * This method handles setting the property values directly in the View object's fields.
 * propertyConstant tells it which property should be set, value is the value to set
 * the property to.
 *
 * @param propertyConstant The property to be set
 * @param value The value to set the property to
 */
private void setValue(int propertyConstant, float value) {
    //final View.TransformationInfo info = mView.mTransformationInfo;
    View v = mView.get();
    if (v != null) {
        switch (propertyConstant) {
            case TRANSLATION_X:
                //info.mTranslationX = value;
                v.setTranslationX(value);
                break;
            case TRANSLATION_Y:
                //info.mTranslationY = value;
                v.setTranslationY(value);
                break;
            case ROTATION:
                //info.mRotation = value;
                v.setRotation(value);
                break;
            case ROTATION_X:
                //info.mRotationX = value;
                v.setRotationX(value);
                break;
            case ROTATION_Y:
                //info.mRotationY = value;
                v.setRotationY(value);
                break;
            case SCALE_X:
                //info.mScaleX = value;
                v.setScaleX(value);
                break;
            case SCALE_Y:
                //info.mScaleY = value;
                v.setScaleY(value);
                break;
            case X:
                //info.mTranslationX = value - v.mLeft;
                v.setX(value);
                break;
            case Y:
                //info.mTranslationY = value - v.mTop;
                v.setY(value);
                break;
            case ALPHA:
                //info.mAlpha = value;
                v.setAlpha(value);
                break;
        }
    }
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:57,代码来源:ViewPropertyAnimatorHC.java

示例12: setValue

import android.view.View; //导入方法依赖的package包/类
@Override
public void setValue(View target, float value) {
    target.setRotationX(value);
}
 
开发者ID:liuwei1993,项目名称:AndroidAnimationTools,代码行数:5,代码来源:ViewAnimatorBuilder.java

示例13: drawChild

import android.view.View; //导入方法依赖的package包/类
@Override
    public boolean drawChild(Canvas canvas, View child, long drawingTime) {
        // rotateX
        int centerY = getVerticalSpace() / 2;
        int childCenterY = child.getTop() + child.getHeight() / 2;
        float factor = (centerY - childCenterY) * 1f / centerY;
        float alphaFactor = 1 - 0.7f * Math.abs(factor);
        child.setAlpha(alphaFactor * alphaFactor * alphaFactor);
        float scaleFactor = 1 - 0.3f * Math.abs(factor);
        child.setScaleX(scaleFactor);
        child.setScaleY(scaleFactor);

        float rotateRadius = 2.0f * centerY / (float) Math.PI;
        float rad = (centerY - childCenterY) * 1f / rotateRadius;
        float offsetZ = rotateRadius * (1 - (float) Math.cos(rad));
        float rotateDeg = rad * 180 / (float) Math.PI;
        ViewCompat.setZ(child, -offsetZ);
        child.setRotationX(rotateDeg);

        float offsetY = centerY - childCenterY - rotateRadius * (float) Math.sin(rad) * 1.3f;
        child.setTranslationY(offsetY);

        // resize the text size if text can not be shown completely
        if (child instanceof TextView) {
            String data = ((TextView) child).getText().toString();
            if (((TextView) child).getTextSize() == mTextSize) {
                float finalTextSize = mTextSize;
                float dataStringW = StaticLayout.getDesiredWidth(data, 0, data.length(), ((TextView) child).getPaint());
                if (getHorizontalSpace() > 0 && dataStringW * 1.1f > getHorizontalSpace()) {
                    finalTextSize = getHorizontalSpace() / dataStringW / 1.1f * mTextSize;
                }
                ((TextView) child).setTextSize(TypedValue.COMPLEX_UNIT_PX, finalTextSize);
            }
        }

        return super.drawChild(canvas, child, drawingTime);

//        // parent centerY ,item centerY
//        int centerY = (getHeight() - getPaddingTop() - getPaddingBottom()) / 2;
//        int childCenterY = child.getTop() + child.getHeight() / 2;
//        // alpha
//        float factor = (centerY - childCenterY) * 1f / centerY;
//        float currentFactor = 1 - 0.7f * Math.abs(factor);
//        child.setAlpha(currentFactor * currentFactor * currentFactor);
//
//        // rotate radius
//        float rotateRadius = 2.5f * centerY / (float) Math.PI;
//        // deg
//        float rad = (centerY - childCenterY) * 1f / rotateRadius;
//        float rotateDeg = rad * 180 / (float) Math.PI;
//        // for camera
//        float offsetZ = rotateRadius * (1 - (float) Math.cos(rad));
//        canvas.save();
//        // offset Y for item rotate
//        float offsetY = centerY - childCenterY - rotateRadius * (float) Math.sin(rad);
//        canvas.translate(0, offsetY);
//        mCamera.save();
//        mCamera.translate(0, 0, offsetZ);
//        mCamera.rotateX(rotateDeg);
//        mCamera.getMatrix(mMatrix);
//        mCamera.restore();
//        mMatrix.preTranslate(-child.getWidth() / 2, -childCenterY);
//        mMatrix.postTranslate(child.getWidth() / 2, childCenterY);
//        canvas.concat(mMatrix);
//        super.drawChild(canvas, child, drawingTime);
//        canvas.restore();
//        return true;
    }
 
开发者ID:devilist,项目名称:RecyclerWheelPicker,代码行数:69,代码来源:RecyclerWheelPicker.java

示例14: setRotationX

import android.view.View; //导入方法依赖的package包/类
public static void setRotationX(View view, float value) {
    view.setRotationX(value);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:ViewCompatHC.java


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