https://github.com/huangrunhua/likeeffect
制作一个简单的点赞效果
https://github.com/huangrunhua/likeeffect
apple clap ios likebutton likeeffect swift
Last synced: 30 days ago
JSON representation
制作一个简单的点赞效果
- Host: GitHub
- URL: https://github.com/huangrunhua/likeeffect
- Owner: HuangRunHua
- License: mit
- Created: 2019-02-24T12:37:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-19T09:09:21.000Z (about 6 years ago)
- Last Synced: 2025-03-24T16:23:20.208Z (about 2 months ago)
- Topics: apple, clap, ios, likebutton, likeeffect, swift
- Language: Swift
- Homepage:
- Size: 861 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LikeEffect
I worte this demo for learning, this demo is a clap animation can be used in many app.
## Requirements
- Xcode9 and later
- iOS 12.1 and later
- Swift4.0 and later## Demo
let's see what would happen when you run this simple project.
## Usage
First you must develop your own clap button, and add the code in ViewController.swiftThe following codes are the function when you touch the button.
~~~swift
@objc func likeButtonTapped(sender: UIButton) {
feedbackGenerator?.impactOccurred()
flag = !flag
if flag {
likeButton.setImage(UIImage(named: "2"), for: .normal)
playAnimation()
/**
*设定一段时间以后停止发射粒子
*/
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { [weak self] in
self!.emitterLayer.removeFromSuperlayer()
}
} else {
likeButton.setImage(UIImage(named: "1"), for: .normal)
}
scaleLikeButton()
}
~~~## More
If you want to know how it was built, you can see [make a simple clap demo](https://medium.com/@h76joker/制作一个点赞效果-d73077b34b5f) for reference