rebound
½éÉÜ£º
reboundÊÇfacebookµÄ¿ªÔ´¶¯»¿â¡£¿ÉÒÔÈÏΪÕâ¸ö¶¯»¿âÊǶÀÁ¢ÓÚandroid FrameworkÖ®ÍâµÄÒ»ÖÖ¶¯»ÊµÏÖ¡£
ÔËÐÐЧ¹û£º
ʹÓÃ˵Ã÷£º
1.Ê×ÏÈÌí¼ÓRebound¿âÒÀÀµ
ReboundÌṩÁËÈýÖÖ·½Ê½ÒýÈ룬µ±È»ÔÚAndroid StudioÏ»¹ÊÇÍƼöʹÓÃGradle·½Ê½¡£
- Ìí¼ÓGradleÒÀÀµ£¨ÍƼö£©
dependencies {
compile 'com.facebook.rebound:rebound:0.3.6'
}
-
ÏÂÔØRebound JarÎļþ£¬µ¼È빤³Ì
-
Ìí¼ÓMavenÒÀÀµ
<dependency>
<groupId>com.facebook.rebound</groupId>
<artifactId>rebound</artifactId>
<version>0.3.6</version>
</dependency>
2.Ê×ÏÈ´´½¨Ò»¸öSpringSystem
¶ÔÏó
SpringSystem mSpringSystem = SpringSystem.create();
3.Ìí¼ÓÒ»¸ö¡°µ¯»É¡±µ½ÏµÍ³
Spring mSpring = mSpringSystem.createSpring();
4.Ìí¼Ó¼àÌýÆ÷
mSpring.addListener(this);
//ʵÏÖSpringListener½Ó¿Ú£¬ÐèҪʵÏÖÏÂÃæ·½·¨
@Override
public void onSpringUpdate(Spring spring) {
}
@Override
public void onSpringAtRest(Spring spring) {
}
@Override
public void onSpringActivate(Spring spring) {
}
@Override
public void onSpringEndStateChange(Spring spring) {
}
5.ÉèÖö¯»½áÊøÖµ
mSpring.setEndValue(1f);
6.ÔÚµ¯»É¸üÐÂÊý¾ÝÊǶÔͼƬ½øÐжÔÓ¦ÉìËõ
public void onSpringUpdate(Spring spring) {
float value = (float) spring.getCurrentValue();
float scale = 1f - (value * 0.5f);
mImageToAnimate.setScaleX(scale);
mImageToAnimate.setScaleY(scale);
}
ͨ¹ýÉÏÃ漸¸ö²½Öè¿ÉÒԺܷ½±ãµÄʵÏÖµ¯»É×èÄáЧ¹ûµÄͼƬÉìËõ¡£
²Î¿¼ :http://qichaochen.github.io/2014/11/21/107-Facebook-Rebound-Demo/
已下载
0