愛你最好的距離 ? — 氣球飛走了slider 練習

@IBAction func didTapSlider(_ sender: UISlider) {    let speed = sender.value * 65    let size = sender.value * 70    self.balloonImageView.frame.origin.x = CGFloat(378-speed * 6)    self.balloonImageView.frame.size = CGSize(width: CGFloat(201 - size), height: CGFloat(249 - size))    self.balloonImageView.alpha = CGFloat(1-sender.value)    if self.balloonImageView.frame.origin.x == 378 {        self.girlImageView.image = UIImage(named: "girl_happy" )

}else if self.balloonImageView.frame.origin.x < 378 && self.balloonImageView.frame.origin.x > 164 {
self.girlImageView.image = UIImage(named: "girl_notHappy" ) }else { self.girlImageView.image = UIImage(named: "girl_cry" )
}
}

GitHub:

--

--