您的位置:首页 > 其它

抛硬币动画--我的第一个开源项目

2016-01-18 16:51 786 查看

前言

最近在项目里要实现一个抛硬币的效果,在网上搜了搜,没有找到很合适的开源项目。这时想到了郭霖博客里的签名:每当你在感叹,如果有这样一个东西就好了的时候,请注意,其实这是你的机会。所以就有了它 https://github.com/binbincivil/TossImageView

使用

布局

<com.bbcivil.toss.TossImageView
android:id="@+id/tiv"
android:layout_width="100dp"
android:layout_height="100dp"/>


播放动画

mTossImageView.startToss();




配置动画

如果默认的动画效果不能满足你的需求,TossImageView支持xml或者java代码两种方式配置动画:

<com.bbcivil.toss.TossImageView
android:id="@+id/tiv"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
toss:circleCount="@integer/toss_default_circleCount"
toss:duration="@integer/toss_default_duration"
toss:frontDrawable="@drawable/front"
toss:result="front"
toss:reverseDrawable="@drawable/reverse"
toss:startOffset="@integer/toss_default_startOffset"
toss:xAxisDirection="clockwise"
toss:yAxisDirection="clockwise"
toss:zAxisDirection="clockwise" />




和其他动画混合使用

TossImageView提供了方法,可以实现和其他View Animation一起使用。

可以轻松实现如下的效果



鼓励鼓励我

https://github.com/binbincivil/TossImageView

这是我人生的第一次。。。写开源项目,代码是看了一遍又一遍,最后才战战兢兢的点了push。如果这个项目能对你有所帮助,我将会感到莫大的欣慰。如果你能在github上为我点个star,我将会感激不尽的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: