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


Java Spring類代碼示例

本文整理匯總了Java中com.facebook.rebound.Spring的典型用法代碼示例。如果您正苦於以下問題:Java Spring類的具體用法?Java Spring怎麽用?Java Spring使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Spring類屬於com.facebook.rebound包,在下文中一共展示了Spring類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setSpringSystem

import com.facebook.rebound.Spring; //導入依賴的package包/類
private void setSpringSystem() {
    mSpringSystem = SpringSystem.create();
    mSpringsAlpha = mSpringSystem.createSpring()
            .setSpringConfig(alphaconfig)
            .setCurrentValue(1);

    mSpringsAlpha.addListener(new SimpleSpringListener() {

        @Override
        public void onSpringUpdate(Spring mSpring) {
            float value = (float) mSpring.getCurrentValue();
            mLockView.setAlpha(value);
        }
    });


}
 
開發者ID:MartinRGB,項目名稱:android_camera_experiment,代碼行數:18,代碼來源:SandriosCameraActivity.java

示例2: applyBloomOpenAnimation

import com.facebook.rebound.Spring; //導入依賴的package包/類
private void applyBloomOpenAnimation() {
    final SpringSystem springSystem = SpringSystem.create();

    for (int i = 0; i < mMenuItemCount; i++) {
        // create the springs that control movement
        final Spring springX = springSystem.createSpring();
        final Spring springY = springSystem.createSpring();

        MenuItemView menuItemView = mMenuItemViews.get(i);
        springX.addListener(new MapPerformer(menuItemView, View.X, mFAB.getLeft(), menuItemView.getLeft()));
        springY.addListener(new MapPerformer(menuItemView, View.Y, mFAB.getTop(), menuItemView.getTop()));
        DestroySelfSpringListener destroySelfSpringListener = new DestroySelfSpringListener(this,mContainerView,true);
        springX.addListener(destroySelfSpringListener);
        springY.addListener(destroySelfSpringListener);
        springX.setEndValue(1);
        springY.setEndValue(1);
    }
}
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:19,代碼來源:SpringFloatingActionMenu.java

示例3: applyBloomCloseAnimation

import com.facebook.rebound.Spring; //導入依賴的package包/類
private void applyBloomCloseAnimation() {
    final SpringSystem springSystem = SpringSystem.create();

    for (int i = 0; i < mMenuItemCount; i++) {
        // create the springs that control movement
        final Spring springX = springSystem.createSpring();
        final Spring springY = springSystem.createSpring();

        MenuItemView menuItemView = mMenuItemViews.get(i);
        springX.addListener(new MapPerformer(menuItemView, View.X, menuItemView.getLeft(), mFAB.getLeft()));
        springY.addListener(new MapPerformer(menuItemView, View.Y, menuItemView.getTop(), mFAB.getTop()));
        DestroySelfSpringListener destroySelfSpringListener = new DestroySelfSpringListener(this,mContainerView,false);
        springX.addListener(destroySelfSpringListener);
        springY.addListener(destroySelfSpringListener);
        springX.setEndValue(1);
        springY.setEndValue(1);
    }
}
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:19,代碼來源:SpringFloatingActionMenu.java

示例4: applyPressAnimation

import com.facebook.rebound.Spring; //導入依賴的package包/類
private void applyPressAnimation() {
    SpringSystem springSystem = SpringSystem.create();
    final Spring spring = springSystem.createSpring();
    spring.addListener(new Performer(mBtn, View.SCALE_X));
    spring.addListener(new Performer(mBtn, View.SCALE_Y));
    mBtn.setOnTouchListener(new ToggleImitator(spring, 1, 1.2){
        @Override
        public void imitate(MotionEvent event) {
            super.imitate(event);
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    break;

                case MotionEvent.ACTION_UP:
                    callOnClick();
                    break;

                default:
            }
        }
    });
    spring.setCurrentValue(1);
}
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:24,代碼來源:MenuItemView.java

示例5: bounceView

import com.facebook.rebound.Spring; //導入依賴的package包/類
/**
 * Bounce the view. Will use the respective values for center and radial view
 * @param child
 *      The child that has to be bounced
 * @param springAnimator
 *      The spring animator with the listener to be invoked.
 *      Set null if you dont need to intercept the spring animation end
 *
 * @author Melvin Lobo
 */
private void bounceView(View child, SpringAnimator springAnimator) {
	LayoutParams params = (LayoutParams) child.getLayoutParams();

	if(params.getMenuType() == LayoutParams.CENTER) {
		Spring centerScaleSpring = mSpringSystem.createSpring();
		centerScaleSpring.setSpringConfig( new SpringConfig( CENTER_SCALE_TENSION, CENTER_SCALE_FRICTION ) );
		centerScaleSpring.setEndValue( 1 );
		centerScaleSpring.addListener( springAnimator );
	}
	else {
		Spring radialScaleSpring = mSpringSystem.createSpring();
		radialScaleSpring.setSpringConfig( new SpringConfig( RADIAL_SCALE_TENSION, RADIAL_SCALE_FRICTION ) );
		radialScaleSpring.setEndValue( 1 );
		radialScaleSpring.addListener( springAnimator );
	}
}
 
開發者ID:melvinjlobo,項目名稱:SpiderMenu,代碼行數:27,代碼來源:SpiderMenu.java

示例6: onSpringUpdate

import com.facebook.rebound.Spring; //導入依賴的package包/類
@Override
public void onSpringUpdate(Spring spring) {
    // On each update of the spring value, we adjust the scale of the image view to match
    // the
    // springs new value. We use the SpringUtil linear interpolation function
    // mapValueFromRangeToRange
    // to translate the spring's 0 to 1 scale to a 100% to 50% scale range and apply that to
    // the View
    // with setScaleX/Y. Note that rendering is an implementation detail of the application
    // and not
    // Rebound itself. If you need Gingerbread compatibility consider using NineOldAndroids
    // to update
    // your view properties in a backwards compatible manner.
    float mappedValue = (float) SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 1, 0.5);
    mImageView.setScaleX(mappedValue);
    mImageView.setScaleY(mappedValue);
}
 
開發者ID:cheyiliu,項目名稱:test4XXX,代碼行數:18,代碼來源:MainActivity.java

示例7: addMotion

import com.facebook.rebound.Spring; //導入依賴的package包/類
/**
 * @param spring
 * 		the underlying {@link com.facebook.rebound.Spring}.
 * @param eventImitator
 * 		maps an event to a {@link com.facebook.rebound.Spring}
 * @param performers
 * 		map the {@link com.facebook.rebound.Spring} to a
 * 		{@link android.view.View}
 * @return the builder for chaining
 */
@NonNull
public Builder addMotion(@NonNull final Spring spring, @NonNull final EventImitator eventImitator,
                         @NonNull final Performer... performers) {

	final Motion motion = new Motion(spring, eventImitator, performers, null);

	// connect actors
	motion.imitators[0].setSpring(motion.spring);

	for (Performer performer : motion.performers) {
		performer.setTarget(mView);
	}

	mMotions.add(motion);

	return this;
}
 
開發者ID:tumblr,項目名稱:Backboard,代碼行數:28,代碼來源:Actor.java

示例8: togglePosition

import com.facebook.rebound.Spring; //導入依賴的package包/類
private void togglePosition() {
    double d = PathListView.NO_ZOOM;
    double currentValue = this.mRevealerSpring.getEndValue();
    Spring spring = this.mRevealerSpring;
    if (currentValue == PathListView.NO_ZOOM) {
        d = 0.0d;
    }
    spring.setEndValue(d);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:SpringConfiguratorView.java

示例9: start

import com.facebook.rebound.Spring; //導入依賴的package包/類
public void start(){
    SpringSystem springSystem = SpringSystem.create();
    Spring spring  = springSystem.createSpring();
    if (mConfig == 0){
        spring.setSpringConfig(SpringConfig.fromBouncinessAndSpeed(mConfigValueOne, mConfigValueTwo));
    }else if (mConfig == 1){
        spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(mConfigValueOne, mConfigValueTwo));
    }
    start(spring);
}
 
開發者ID:UFreedom,項目名稱:FloatingView,代碼行數:11,代碼來源:SpringHelper.java

示例10: onSpringUpdate

import com.facebook.rebound.Spring; //導入依賴的package包/類
@Override
public void onSpringUpdate(Spring spring) {
    // On each update of the spring value, we adjust the scale of the image view to match the
    // springs new value. We use the SpringUtil linear interpolation function mapValueFromRangeToRange
    // to translate the spring's 0 to 1 scale to a 100% to 50% scale range and apply that to the View
    // with setScaleX/Y. Note that rendering is an implementation detail of the application and not
    // Rebound itself. If you need Gingerbread compatibility consider using NineOldAndroids to update
    // your view properties in a backwards compatible manner.
    float mappedValue = (float) SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 1, 0.5);
    suggestionView.setScaleX(mappedValue);
    suggestionView.setScaleY(mappedValue);
}
 
開發者ID:hanuor,項目名稱:sapphire,代碼行數:13,代碼來源:MainActivity.java

示例11: onSpringUpdate

import com.facebook.rebound.Spring; //導入依賴的package包/類
@Override
public void onSpringUpdate(Spring spring) {
    float mappedvalue = (float) SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 1, 0.8);
    view.setScaleX(mappedvalue);
    view.setScaleY(mappedvalue);

    float rotation = (float) SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 0, 30);
    view.setRotation(rotation);
}
 
開發者ID:J1aDong,項目名稱:Gank-Meizi,代碼行數:10,代碼來源:ReboundImageView.java

示例12: 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

示例13: 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

示例14: showLabel

import com.facebook.rebound.Spring; //導入依賴的package包/類
public void showLabel() {
    SpringSystem springSystem = SpringSystem.create();
    final Spring spring = springSystem.createSpring();
    spring.addListener(new MapPerformer(mLabel, View.SCALE_X, 0, 1));
    spring.addListener(new MapPerformer(mLabel, View.SCALE_Y, 0, 1));
    spring.setCurrentValue(0);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            spring.setEndValue(1);
        }
    }, 200);
}
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:14,代碼來源:MenuItemView.java

示例15: onSpringAtRest

import com.facebook.rebound.Spring; //導入依賴的package包/類
@Override
public void onSpringAtRest(Spring spring) {
    spring.removeAllListeners();
    spring.destroy();
    spring = null;
    if(mSpringMenu != null && !mInOpen) {
        mSpringMenu.removeView(view);
    }
}
 
開發者ID:tiancaiCC,項目名稱:SpringFloatingActionMenu,代碼行數:10,代碼來源:DestroySelfSpringListener.java


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