79465545

Date: 2025-02-25 06:10:37
Score: 1
Natty:
Report link

Here are coin collecting animation code. Code is animate the image in timer.

func animateCoin() {
    count = count + 1
    
    let moneyView = UIImageView(image: UIImage(named: "Your image name"))
    moneyView.frame = CGRect(x: 100, y: self.view.frame.size.height - 350, width: 100, height: 100)
    view.addSubview(moneyView)
    
    UIView.animate(withDuration: 1.0, animations: {
        moneyView.frame.origin.x = 250
        moneyView.frame.origin.y = 100
        AudioServicesPlaySystemSound(1122)
    }) { _ in }
}

func startCoinAnimation() {
    Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
        self.animateCoin()
        if self.count == 10 {
            timer.invalidate()
            self.count = 0
        }
    }
}

Here is Demo link how animation look : https://www.youtube.com/watch?v=GR9hIpNeL-U

Reasons:
  • Blacklisted phrase (1): youtube.com
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: iOS Developer