當前位置: 首頁>>代碼示例>>Java>>正文


Java Spring.getCurrentValue方法代碼示例

本文整理匯總了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();
}
 
開發者ID:CarlisleChan,項目名稱:Incubators,代碼行數:32,代碼來源:IOSToggleButton.java

示例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);
}
 
開發者ID:sdsmdg,項目名稱:liener,代碼行數:8,代碼來源:BubbleHead.java

示例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);
}
 
開發者ID:xujunbin,項目名稱:FloatWindow,代碼行數:10,代碼來源:SpringConfiguratorView.java

示例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());
  }
}
 
開發者ID:cheyiliu,項目名稱:test4XXX,代碼行數:10,代碼來源:ExampleContainerView.java

示例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);
}
 
開發者ID:wangkang0627,項目名稱:SwipCard,代碼行數:8,代碼來源:DragCard.java

示例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 ));
}
 
開發者ID:ppamorim,項目名稱:Bound,代碼行數:13,代碼來源:SpringController.java

示例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)));
  }
}
 
開發者ID:ppamorim,項目名稱:pagarme-android,代碼行數:28,代碼來源:CardHashView.java

示例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());
      }
    }
 
開發者ID:ppamorim,項目名稱:Dragger,代碼行數:32,代碼來源:DraggerView.java

示例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);
}
 
開發者ID:ppamorim,項目名稱:PrismView,代碼行數:8,代碼來源:PrismActivity.java

示例10: onSpringAtRestOut

import com.facebook.rebound.Spring; //導入方法依賴的package包/類
private void onSpringAtRestOut(Spring spring) {
  if (hideEnabled) {
    if (spring.getCurrentValue() == 1) {
      showPrismView();
    } else {
      showMainView();
    }
  }
}
 
開發者ID:ppamorim,項目名稱:PrismView,代碼行數:10,代碼來源:PrismActivity.java

示例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);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:7,代碼來源:SpringConfiguratorView.java

示例12: onSpringUpdate

import com.facebook.rebound.Spring; //導入方法依賴的package包/類
@Override
public void onSpringUpdate(Spring spring) {
    final double value = spring.getCurrentValue();
    calculateEffect(value);
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:6,代碼來源:SwitchButton.java

示例13: onSpringUpdate

import com.facebook.rebound.Spring; //導入方法依賴的package包/類
@Override
public void onSpringUpdate(Spring spring) {
	final double value = spring.getCurrentValue();
	calculateEffect(value);
}
 
開發者ID:xujunbin,項目名稱:FloatWindow,代碼行數:6,代碼來源:ToggleButton.java

示例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;
}
 
開發者ID:tumblr,項目名稱:Backboard,代碼行數:6,代碼來源:ExplosionFragment.java

示例15: getYFromSpring

import com.facebook.rebound.Spring; //導入方法依賴的package包/類
private int getYFromSpring(Spring spring) {
    return centerY + (int) spring.getCurrentValue() - getMeasuredHeight() / 2;
}
 
開發者ID:flipkart-incubator,項目名稱:springy-heads,代碼行數:4,代碼來源:ChatHeadCloseButton.java


注:本文中的com.facebook.rebound.Spring.getCurrentValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。