1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // TSPurchasePromotionalVC+Animation.swift
- // AIEmoji
- //
- // Created by 100Years on 2025/7/2.
- //
- import APNGKit
- import Delegate
- extension TSPurchasePromotionalVC {
- func creatApngImageView() -> APNGImageView {
- let image = try! APNGImage(named: "Gift")
- image.numberOfPlays = 1
- let apngImageView = APNGImageView(image: image)
- apngImageView.autoStartAnimationWhenSetImage = false
- apngImageView.onAllPlaysDone.delegate(on: self) { (self, _) in
-
- UIView.animate(withDuration: 0.5, animations: {
- self.animationView.alpha = 0
- self.contentView.alpha = 1
- }, completion: { finished in
- dePrint("kPurchaseCountDownTime.start")
- kPurchaseCountDownTime.start()
- self.animationView.removeFromSuperview()
- })
- }
- return apngImageView
- }
-
- static var showGift:Bool{
- if kPurchaseDefault.isVip == false,
- kPurchaseDefault.checkLocalReceiptForIntroOffer(type: .week(.weekPromotional1)) == false,
- kPurchaseCountDownTime.isShowGift{
- return true
- }
- return false
- }
- func addApngImageView(){
-
- animationView.backgroundColor = .black.withAlphaComponent(0.8)
- self.view.addSubview(animationView)
- animationView.snp.makeConstraints { make in
- make.edges.equalToSuperview()
- }
-
- animationView.addSubview(animationLab)
- animationLab.snp.makeConstraints { make in
- make.center.equalToSuperview()
- }
-
- animationView.addSubview(apngImageView)
- apngImageView.snp.makeConstraints { make in
- make.centerY.equalToSuperview()
- make.width.height.equalTo(k_ScreenWidth)
- }
- kMainShort(){
- self.animationLab.setNeedsLayout()
- self.animationLab.alpha = 1
- self.animationLab.applyGradient(colors: ["#FA794F".uiColor,"#F8C32A".uiColor,"#FEFBF4".uiColor])
- self.animationLab.alpha = 0.0
- kMainAfter(0.5) {
- self.apngImageView.startAnimating()
- UIView.animate(withDuration: 0.8) {
- self.animationLab.transform = CGAffineTransform(translationX: 0, y: -150)
- self.animationLab.alpha = 1
- }
- }
- }
- }
- }
|