本文整理汇总了Java中com.nineoldandroids.view.ViewHelper.setPivotX方法的典型用法代码示例。如果您正苦于以下问题:Java ViewHelper.setPivotX方法的具体用法?Java ViewHelper.setPivotX怎么用?Java ViewHelper.setPivotX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.view.ViewHelper
的用法示例。
在下文中一共展示了ViewHelper.setPivotX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformPage
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
public void transformPage(View page, float position) {
if (position < -1) {
ViewHelper.setRotation(page, 0);
} else if (position <= 1) {
if (position < 0) {
mRot = (ROT_MAX * position);
ViewHelper.setPivotX(page, page.getMeasuredWidth() * 0.5f);
ViewHelper.setPivotY(page, page.getMeasuredHeight());
ViewHelper.setRotation(page, mRot);
} else {
mRot = (ROT_MAX * position);
ViewHelper.setPivotX(page, page.getMeasuredWidth() * 0.5f);
ViewHelper.setPivotY(page, page.getMeasuredHeight());
ViewHelper.setRotation(page, mRot);
}
} else {
ViewHelper.setRotation(page, 0);
}
}
示例2: animateCube
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateCube(View left, View right, float positionOffset, boolean in) {
if (mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
mRot = (in ? 90.0f : -90.0f) * positionOffset;
ViewHelper.setPivotX(left, left.getMeasuredWidth());
ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
ViewHelper.setRotationY(left, mRot);
}
if (right != null) {
manageLayer(right, true);
mRot = -(in ? 90.0f : -90.0f) * (1-positionOffset);
ViewHelper.setPivotX(right, 0);
ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
ViewHelper.setRotationY(right, mRot);
}
}
}
示例3: animateZoom
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateZoom(View left, View right, float positionOffset, boolean in) {
if (mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
mScale = in ? ZOOM_MAX + (1-ZOOM_MAX)*(1-positionOffset) :
1+ZOOM_MAX - ZOOM_MAX*(1-positionOffset);
ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
ViewHelper.setScaleX(left, mScale);
ViewHelper.setScaleY(left, mScale);
}
if (right != null) {
manageLayer(right, true);
mScale = in ? ZOOM_MAX + (1-ZOOM_MAX)*positionOffset :
1+ZOOM_MAX - ZOOM_MAX*positionOffset;
ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
ViewHelper.setScaleX(right, mScale);
ViewHelper.setScaleY(right, mScale);
}
}
}
示例4: animateRotate
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateRotate(View left, View right, float positionOffset, boolean up) {
if (mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
mRot = (up ? 1 : -1) * (ROT_MAX * positionOffset);
mTrans = (up ? -1 : 1) * (float) (getMeasuredHeight() - getMeasuredHeight()*Math.cos(mRot*Math.PI/180.0f));
ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(left, up ? 0 : left.getMeasuredHeight());
ViewHelper.setTranslationY(left, mTrans);
ViewHelper.setRotation(left, mRot);
}
if (right != null) {
manageLayer(right, true);
mRot = (up ? 1 : -1) * (-ROT_MAX + ROT_MAX*positionOffset);
mTrans = (up ? -1 : 1) * (float) (getMeasuredHeight() - getMeasuredHeight()*Math.cos(mRot*Math.PI/180.0f));
ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(right, up ? 0 : right.getMeasuredHeight());
ViewHelper.setTranslationY(right, mTrans);
ViewHelper.setRotation(right, mRot);
}
}
}
示例5: animateAccordion
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateAccordion(View left, View right, float positionOffset) {
if (mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
ViewHelper.setPivotX(left, left.getMeasuredWidth());
ViewHelper.setPivotY(left, 0);
ViewHelper.setScaleX(left, 1-positionOffset);
}
if (right != null) {
manageLayer(right, true);
ViewHelper.setPivotX(right, 0);
ViewHelper.setPivotY(right, 0);
ViewHelper.setScaleX(right, positionOffset);
}
}
}
示例6: clear
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
public static void clear(View v) {
ViewHelper.setAlpha(v, 1);
ViewHelper.setScaleY(v, 1);
ViewHelper.setScaleX(v, 1);
ViewHelper.setTranslationY(v, 0);
ViewHelper.setTranslationX(v, 0);
ViewHelper.setRotation(v, 0);
ViewHelper.setRotationY(v, 0);
ViewHelper.setRotationX(v, 0);
// @TODO https://code.google.com/p/android/issues/detail?id=80863
// ViewHelper.setPivotY(v, v.getMeasuredHeight() / 2);
v.setPivotY(v.getMeasuredHeight() / 2);
ViewHelper.setPivotX(v, v.getMeasuredWidth() / 2);
ViewPropertyAnimator.animate(v).setInterpolator(null);
}
示例7: runEnterAnimation
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
/**
* The enter animation scales the picture in from its previous thumbnail
* size/location, colorizing it in parallel. In parallel, the background of the
* activity is fading in. When the pictue is in place, the text description
* drops down.
*/
private void runEnterAnimation() {
final long duration = ANIM_DURATION;
// Set starting values for properties we're going to animate. These
// values scale and position the full size version down to the thumbnail
// size/location, from which we'll animate it back up
ViewHelper.setPivotX(mViewPager, 0);
ViewHelper.setPivotY(mViewPager, 0);
ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth());
ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight());
ViewHelper.setTranslationX(mViewPager, thumbnailLeft);
ViewHelper.setTranslationY(mViewPager, thumbnailTop);
// Animate scale and translation to go from thumbnail to full size
ViewPropertyAnimator.animate(mViewPager)
.setDuration(duration)
.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());
// Fade in the black background
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255);
bgAnim.setDuration(duration);
bgAnim.start();
// Animate a color filter to take the image from grayscale to full color.
// This happens in parallel with the image scaling and moving into place.
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this,
"saturation", 0, 1);
colorizer.setDuration(duration);
colorizer.start();
}
示例8: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float height = view.getHeight();
final float width = view.getWidth();
final float scale = min(position > 0 ? 1f : Math.abs(1f + position), 0.5f);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,width * 0.5f);
ViewHelper.setPivotY(view,height * 0.5f);
ViewHelper.setTranslationX(view,position > 0 ? width * position : -width * position * 0.25f);
}
示例9: animateScroll
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
protected void animateScroll(int position, float positionOffset) {
if (mState != State.IDLE) {
mRot = (float)(1-Math.cos(2*Math.PI*positionOffset))/2*30.0f;
ViewHelper.setRotationY(this, mState == State.GOING_RIGHT ? mRot : -mRot);
ViewHelper.setPivotX(this, getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(this, getMeasuredHeight()*0.5f);
}
}
示例10: resetVerticalAnimation
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
/**
* Set starting params to vertical animations
*/
private void resetVerticalAnimation(View view, boolean toTop) {
if (!mIsMenuOpen) {
ViewHelper.setRotation(view, 0);
ViewHelper.setRotationY(view, 0);
ViewHelper.setRotationX(view, -90);
}
ViewHelper.setPivotX(view, mMenuItemSize / 2);
ViewHelper.setPivotY(view, !toTop ? 0 : mMenuItemSize);
}
示例11: animateFlipHorizontal
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateFlipHorizontal(View left, View right, float positionOffset, int positionOffsetPixels) {
if (mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
mRot = 180.0f * positionOffset;
if (mRot > 90.0f) {
left.setVisibility(View.INVISIBLE);
} else {
if (left.getVisibility() == View.INVISIBLE)
left.setVisibility(View.VISIBLE);
mTrans = positionOffsetPixels;
ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
ViewHelper.setTranslationX(left, mTrans);
ViewHelper.setRotationY(left, mRot);
}
}
if (right != null) {
manageLayer(right, true);
mRot = -180.0f * (1-positionOffset);
if (mRot < -90.0f) {
right.setVisibility(View.INVISIBLE);
} else {
if (right.getVisibility() == View.INVISIBLE)
right.setVisibility(View.VISIBLE);
mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
ViewHelper.setTranslationX(right, mTrans);
ViewHelper.setRotationY(right, mRot);
}
}
}
}
示例12: animateFlipVertical
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateFlipVertical(View left, View right, float positionOffset, int positionOffsetPixels) {
if(mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
mRot = 180.0f * positionOffset;
if (mRot > 90.0f) {
left.setVisibility(View.INVISIBLE);
} else {
if (left.getVisibility() == View.INVISIBLE)
left.setVisibility(View.VISIBLE);
mTrans = positionOffsetPixels;
ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
ViewHelper.setTranslationX(left, mTrans);
ViewHelper.setRotationX(left, mRot);
}
}
if (right != null) {
manageLayer(right, true);
mRot = -180.0f * (1-positionOffset);
if (mRot < -90.0f) {
right.setVisibility(View.INVISIBLE);
} else {
if (right.getVisibility() == View.INVISIBLE)
right.setVisibility(View.VISIBLE);
mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
ViewHelper.setTranslationX(right, mTrans);
ViewHelper.setRotationX(right, mRot);
}
}
}
}
示例13: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float width = view.getWidth();
final float rotation = ROT_MOD * position;
ViewHelper.setPivotX(view,width * 0.5f);
ViewHelper.setPivotY(view,0f);
ViewHelper.setTranslationX(view,0f);
ViewHelper.setRotation(view,rotation);
}
示例14: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float width = view.getWidth();
final float height = view.getHeight();
final float rotation = ROT_MOD * position * -1.25f;
ViewHelper.setPivotX(view,width * 0.5f);
ViewHelper.setPivotY(view,height);
ViewHelper.setRotation(view,rotation);
}
示例15: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float height = view.getHeight();
final float width = view.getWidth();
final float scale = min(position < 0 ? 1f : Math.abs(1f - position), 0.5f);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,width*0.5f);
ViewHelper.setPivotY(view,height*0.5f);
ViewHelper.setTranslationX(view,position < 0 ? width * position : -width * position * 0.25f);
}