Skip to content

Instantly share code, notes, and snippets.

@Pudding124
Created June 6, 2018 02:22
Show Gist options
  • Save Pudding124/469faf61e9899ae7ec09d0cb41d7ae93 to your computer and use it in GitHub Desktop.
Save Pudding124/469faf61e9899ae7ec09d0cb41d7ae93 to your computer and use it in GitHub Desktop.
// 控制連擊動畫
func AnimateAlpha(comboNumber : Int) {
self.combo.alpha = 1
if comboNumber > 0{
combo.text = String(comboNumber)+" COMBO"
}
UIView.animate(withDuration: 0.7, delay: 0, animations: {
self.combo.alpha -= 1
self.combo.transform = CGAffineTransform.identity
.translatedBy(x: -100, y: 0)
.rotated(by:CGFloat(Double.pi/4))
.scaledBy(x: 2, y: 2)
}, completion: { _ in
self.combo.transform = CGAffineTransform.identity
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment