diff --git a/README.md b/README.md
index 8437cd9..0b19835 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,71 @@
-# WLikeView
+# WLikeAnim - 简单的点赞动画
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## 依赖
+
+```gradle
+allprojects {
+ repositories {
+ ...
+ maven { url 'https://jitpack.io' }
+ }
+ }
+
+dependencies {
+ implementation 'com.github.wanglu1209:WLikeAnim:lastRelease'
+}
+```
+
+## 使用
+
+### 普通的动画效果
+效果看第一个图 或者[WPopup](https://github.com/wanglu1209/WPopup)(只是简单的缩放)
+
+```Kotlin
+WCommonAnim(iv).show()
+```
+
+### 类似于掘金的动画效果
+
+```Kotlin
+// 第一个参数为点赞的ImageView,第二个参数为想要替换的res
+WJueJinLikeAnim.Builder(ImageView, R.mipmap.xxx).create().show()
+```
+
+## 解释
+
+**该动画库只有动画,完全不参与逻辑**
+
+类似于下面,所有的逻辑都要自己写:
+
+```Kotlin
+var isLiked = false
+val likeAnim = WJueJinLikeAnim.Builder(iv, R.mipmap.fd_zan_press).create()
+iv.setOnClickListener {
+ if(isLiked){
+ iv.setImageResource(R.mipmap.fd_zan)
+ isLiked = false
+ }else{
+ iv.setImageResource(R.mipmap.fd_zan_press)
+ isLiked = true
+ likeAnim.show()
+ }
+}
+```
+
diff --git a/app/src/main/java/com/wanglu/wlikeview/MainActivity.kt b/app/src/main/java/com/wanglu/wlikeview/MainActivity.kt
index 1323bd7..b3ab31d 100644
--- a/app/src/main/java/com/wanglu/wlikeview/MainActivity.kt
+++ b/app/src/main/java/com/wanglu/wlikeview/MainActivity.kt
@@ -2,6 +2,7 @@ package com.wanglu.wlikeview
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
+import com.wanglu.lib.WCommonAnim
import com.wanglu.lib.juejin.WJueJinLikeAnim
import kotlinx.android.synthetic.main.activity_main.*
@@ -11,15 +12,17 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
- var liked = false
+ WCommonAnim(iv).show()
+
+ var isLiked = false
val likeAnim = WJueJinLikeAnim.Builder(iv, R.mipmap.fd_zan_press).create()
iv.setOnClickListener {
- if(liked){
+ if(isLiked){
iv.setImageResource(R.mipmap.fd_zan)
- liked = false
+ isLiked = false
}else{
iv.setImageResource(R.mipmap.fd_zan_press)
- liked = true
+ isLiked = true
likeAnim.show()
}
}
diff --git a/gif/gif.gif b/gif/gif.gif
new file mode 100644
index 0000000..c63def3
Binary files /dev/null and b/gif/gif.gif differ
diff --git a/lib/src/main/java/com/wanglu/lib/WCommonAnim.kt b/lib/src/main/java/com/wanglu/lib/WCommonAnim.kt
index 14f0d13..fb49211 100644
--- a/lib/src/main/java/com/wanglu/lib/WCommonAnim.kt
+++ b/lib/src/main/java/com/wanglu/lib/WCommonAnim.kt
@@ -16,7 +16,7 @@ class WCommonAnim(private val view: View) {
animSet.duration = 200
}
- fun start() {
+ fun show() {
if (animSet.isRunning)
animSet.cancel()