Skip to content

Instantly share code, notes, and snippets.

@ktanaka117
Created December 31, 2018 15:25
Show Gist options
  • Save ktanaka117/e4fd8f04b89c336632f91213f394cbc6 to your computer and use it in GitHub Desktop.
Save ktanaka117/e4fd8f04b89c336632f91213f394cbc6 to your computer and use it in GitHub Desktop.
let textColorAnimation = CABasicAnimation(keyPath: "foregroundColor")
textColorAnimation.duration = 2.0 / 3 // duration = 30fpsのうちの約20frame
textColorAnimation.fromValue = Color.primaryBrand.cgColor
textColorAnimation.toValue = Color.black.cgColor
textColorAnimation.fillMode = .forwards
UIView.animate(withDuration: 2.0 / 3, animations: { [weak self] in
guard let strongSelf = self else { return }
strongSelf.animationText.add(textColorAnimation, forKey: "TextColor")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment