当前位置: 首页>>代码示例>>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;未经允许,请勿转载。