Skip to content

Instantly share code, notes, and snippets.

@stfalconaleks
Created November 22, 2017 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stfalconaleks/4b3ca7b368e88e1cf3822206032facec to your computer and use it in GitHub Desktop.
Save stfalconaleks/4b3ca7b368e88e1cf3822206032facec to your computer and use it in GitHub Desktop.
func animateTextLabels() {
let isExpandedMode = self.extensionContext?.widgetActiveDisplayMode == .expanded
let scaleText:CGFloat = isExpandedMode ? 3 : 0.3
UIView.animate(withDuration: 0.3, delay: 0, options: [.curveEaseOut], animations: {
self.textLabel.transform = .init(scaleX: scaleText, y: scaleText)
self.dateLabel.transform = isExpandedMode ? .init(translationX: 0, y: 20) : .identity
}) { (finished) in
UIView.animate(withDuration: 0.3, animations: {
self.textLabel.transform = .identity
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment