{"action":"opened","issue":{"url":"https://api.github.com/repos/churabou/iOS-develop-blog/issues/36","repository_url":"https://api.github.com/repos/churabou/iOS-develop-blog","labels_url":"https://api.github.com/repos/churabou/iOS-develop-blog/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/churabou/iOS-develop-blog/issues/36/comments","events_url":"https://api.github.com/repos/churabou/iOS-develop-blog/issues/36/events","html_url":"https://github.com/churabou/iOS-develop-blog/issues/36","id":339398189,"node_id":"MDU6SXNzdWUzMzkzOTgxODk=","number":36,"title":"UIViewPropertyAnimator","user":{"login":"churabou","id":29033278,"node_id":"MDQ6VXNlcjI5MDMzMjc4","avatar_url":"https://avatars0.githubusercontent.com/u/29033278?v=4","gravatar_id":"","url":"https://api.github.com/users/churabou","html_url":"https://github.com/churabou","followers_url":"https://api.github.com/users/churabou/followers","following_url":"https://api.github.com/users/churabou/following{/other_user}","gists_url":"https://api.github.com/users/churabou/gists{/gist_id}","starred_url":"https://api.github.com/users/churabou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/churabou/subscriptions","organizations_url":"https://api.github.com/users/churabou/orgs","repos_url":"https://api.github.com/users/churabou/repos","events_url":"https://api.github.com/users/churabou/events{/privacy}","received_events_url":"https://api.github.com/users/churabou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-09T10:46:23Z","updated_at":"2018-07-09T10:46:23Z","closed_at":null,"author_association":"OWNER","body":"\r\n\r\n\r\n``` swift\r\n\r\n    animator.addAnimations {\r\n            red.center.x += 100\r\n            red.center.x += 200\r\n        }\r\n        \r\n       animator.startAnimation()\r\n```\r\n\r\nこれもスムースに動く。\r\n\r\n\r\n\r\n---\r\n\r\n\r\nUIViewのクラスメソッドのanimationの\r\ncompletionはBool型の引数をもつ。\r\n\r\n\r\n一方で\r\n\r\n\r\n\r\n\r\n\r\n\r\n---\r\n\r\n\r\n時間\r\n\r\nクラスメソッドではdurationパラメーター\r\nUIPropertyAnimatorでは初期化時に指定できる。\r\n0を指定するとデフォルトの時間0.2が適用される。\r\n\r\n\r\ndelay\r\n\r\nstartAnimation(afterDelay: 0.3)\r\n\r\n\r\n\r\n\r\n\r\n中断\r\n\r\n``` swift\r\n\r\n      UIView.animate(withDuration: 3, delay: 1, animations: {\r\n            self.red.center.x += 200\r\n       })\r\n\r\n //       red.layer.position = red.layer.presentation()!.position\r\n//        red.layer.removeAllAnimations()\r\n\r\n\r\n```\r\n\r\n animator.pauseAnimation()\r\n\r\n\r\n\r\n\r\n結論\r\n\r\n- 停止が簡単、\r\n- タイミングを自在に操れる。"}}
{"actor":{"display_login":"churabou"}}