本文整理汇总了Java中com.facebook.rebound.Spring.getCurrentValue方法的典型用法代码示例。如果您正苦于以下问题:Java Spring.getCurrentValue方法的具体用法?Java Spring.getCurrentValue怎么用?Java Spring.getCurrentValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.rebound.Spring
的用法示例。
在下文中一共展示了Spring.getCurrentValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
final double value = spring.getCurrentValue();
final float mapToggleX = (float) SpringUtil.mapValueFromRangeToRange(value, 0, 1, spotMinX, spotMaxX);
spotX = mapToggleX;
float mapOffLineWidth = (float) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, 10, spotSize);
offLineWidth = mapOffLineWidth;
final int fb = Color.blue(onColor);
final int fr = Color.red(onColor);
final int fg = Color.green(onColor);
final int tb = Color.blue(offBorderColor);
final int tr = Color.red(offBorderColor);
final int tg = Color.green(offBorderColor);
int sb = (int) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, fb, tb);
int sr = (int) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, fr, tr);
int sg = (int) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, fg, tg);
sb = clamp(sb, 0, 255);
sr = clamp(sr, 0, 255);
sg = clamp(sg, 0, 255);
borderColor = Color.rgb(sr, sg, sb);
postInvalidate();
}
示例2: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
float value = (float) spring.getCurrentValue();
float scale = 1f - (value * 0.5f);
view.setScaleX(scale);
view.setScaleY(scale);
}
示例3: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
float val = (float) spring.getCurrentValue();
float minTranslate = mRevealPx;
float maxTranslate = mStashPx;
float range = maxTranslate - minTranslate;
float yTranslate = (val * range) + minTranslate;
SpringConfiguratorView.this.setTranslationY(yTranslate);
}
示例4: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
double val = spring.getCurrentValue();
float xlat = (float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, getWidth());
setTranslationX(xlat);
if (mCallback != null) {
mCallback.onProgress(spring.getCurrentValue());
}
}
示例5: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
float value = (float) spring.getCurrentValue();
float scale = 1f - (value * 0.5f);
ViewCompat.setScaleX(DragCard.this, scale);
ViewCompat.setScaleY(DragCard.this, scale);
}
示例6: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override public void onSpringUpdate(Spring spring) {
super.onSpringUpdate(spring);
val = spring.getCurrentValue();
ViewCompat.setTranslationX(viewCallback.getFabButton(),
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, centerX + 100));
ViewCompat.setTranslationY(viewCallback.getFabButton(),
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, centerY + 100));
ViewCompat.setTranslationX(viewCallback.getBoundMenu(),
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, centerX + 100));
ViewCompat.setTranslationY(viewCallback.getBoundMenu(),
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, centerY ));
}
示例7: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override public void onSpringUpdate(Spring spring) {
super.onSpringUpdate(spring);
verticalCurrentValue = spring.getCurrentValue();
float rotation = (float) SpringUtil.mapValueFromRangeToRange(verticalCurrentValue, 0, 1,
0, -30);
ViewCompat.setRotationX(frontCreditCardView, rotation);
ViewCompat.setRotationX(backCreditCardView, rotation);
float scale = (float) SpringUtil.mapValueFromRangeToRange(verticalCurrentValue, 0, 1, 1, 0.7);
ViewCompat.setScaleX(frontCreditCardView, scale);
ViewCompat.setScaleY(frontCreditCardView, scale);
ViewCompat.setScaleX(backCreditCardView, scale);
ViewCompat.setScaleY(backCreditCardView, scale);
if(bottomView != null) {
int creditCardHeight = frontCreditCardView.getHeight();
float cardPositionY = (float) SpringUtil.mapValueFromRangeToRange(verticalCurrentValue, 0,
1, 0, -(creditCardHeight / 6.5));
ViewCompat.setTranslationY(frontCreditCardView, cardPositionY);
ViewCompat.setTranslationY(backCreditCardView, cardPositionY);
ViewCompat.setTranslationY(bottomView,
(float) SpringUtil.mapValueFromRangeToRange(verticalCurrentValue, 0, 1, 0,
-(creditCardHeight / 2.5)));
}
}
示例8: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override public void onSpringUpdate(Spring spring) {
double val = spring.getCurrentValue();
switch (dragPosition) {
case LEFT:
ViewCompat.setTranslationX(dragView,
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, -dragView.getWidth()));
break;
case RIGHT:
ViewCompat.setTranslationX(dragView,
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, dragView.getWidth()));
break;
case TOP:
ViewCompat.setTranslationY(dragView,
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, dragView.getHeight()));
break;
case BOTTOM:
ViewCompat.setTranslationY(dragView,
(float) SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, -dragView.getHeight()));
break;
default:
break;
}
ViewCompat.setAlpha(shadowView,
(float) (MAX_ALPHA - SpringUtil.mapValueFromRangeToRange(val, 0, 1, 0, 1)));
if (draggerCallback != null) {
draggerCallback.onProgress(spring.getCurrentValue());
}
}
示例9: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override public void onSpringUpdate(Spring spring) {
super.onSpringUpdate(spring);
double currentValue = spring.getCurrentValue();
ViewCompat.setTranslationX(prismView, (float) SpringUtil.mapValueFromRangeToRange(
currentValue, 0, 1, activityHelper.getWidth(), 0));
mainViewUpdate(currentValue);
}
示例10: onSpringAtRestOut
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
private void onSpringAtRestOut(Spring spring) {
if (hideEnabled) {
if (spring.getCurrentValue() == 1) {
showPrismView();
} else {
showMainView();
}
}
}
示例11: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
public void onSpringUpdate(Spring spring) {
float val = (float) spring.getCurrentValue();
float minTranslate = SpringConfiguratorView.this.mRevealPx;
SpringConfiguratorView.this.setTranslationY((val * (SpringConfiguratorView.this
.mStashPx - minTranslate)) + minTranslate);
}
示例12: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
final double value = spring.getCurrentValue();
calculateEffect(value);
}
示例13: onSpringUpdate
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
@Override
public void onSpringUpdate(Spring spring) {
final double value = spring.getCurrentValue();
calculateEffect(value);
}
示例14: shouldClean
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
public boolean shouldClean(Spring spring) {
// these are arbitrary values to keep the view from disappearing before it is
// fully off the screen
return spring.getCurrentValue() < mMin || spring.getCurrentValue() > mMax;
}
示例15: getYFromSpring
import com.facebook.rebound.Spring; //导入方法依赖的package包/类
private int getYFromSpring(Spring spring) {
return centerY + (int) spring.getCurrentValue() - getMeasuredHeight() / 2;
}