{"action":"created","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/14482","repository_url":"https://api.github.com/repos/flutter/flutter","labels_url":"https://api.github.com/repos/flutter/flutter/issues/14482/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/14482/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/14482/events","html_url":"https://github.com/flutter/flutter/issues/14482","id":294584067,"number":14482,"title":"Allow AnimationController to make Animations","user":{"login":"InMatrix","id":348942,"avatar_url":"https://avatars0.githubusercontent.com/u/348942?v=4","gravatar_id":"","url":"https://api.github.com/users/InMatrix","html_url":"https://github.com/InMatrix","followers_url":"https://api.github.com/users/InMatrix/followers","following_url":"https://api.github.com/users/InMatrix/following{/other_user}","gists_url":"https://api.github.com/users/InMatrix/gists{/gist_id}","starred_url":"https://api.github.com/users/InMatrix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InMatrix/subscriptions","organizations_url":"https://api.github.com/users/InMatrix/orgs","repos_url":"https://api.github.com/users/InMatrix/repos","events_url":"https://api.github.com/users/InMatrix/events{/privacy}","received_events_url":"https://api.github.com/users/InMatrix/received_events","type":"User","site_admin":false},"labels":[{"id":479912027,"url":"https://api.github.com/repos/flutter/flutter/labels/from:%20study","name":"from: study","color":"009800","default":false},{"id":288132724,"url":"https://api.github.com/repos/flutter/flutter/labels/prod:%20animation","name":"prod: animation","color":"207de5","default":false}],"state":"open","locked":false,"assignee":{"login":"Hixie","id":551196,"avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"assignees":[{"login":"Hixie","id":551196,"avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/flutter/flutter/milestones/21","html_url":"https://github.com/flutter/flutter/milestone/21","labels_url":"https://api.github.com/repos/flutter/flutter/milestones/21/labels","id":2005337,"number":21,"title":"3: Current Milestone","description":"These are tasks we want to complete to move from \"alpha\" to \"beta\". This includes being feature complete and ready for people to ship applications.\r\n\r\nThe date on this milestone is utterly arbitrary and just intended to sort the milestone appropriately.","creator":{"login":"Hixie","id":551196,"avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"open_issues":106,"closed_issues":655,"state":"open","created_at":"2016-09-14T22:22:18Z","updated_at":"2018-02-06T00:59:38Z","due_on":"2028-12-31T08:00:00Z","closed_at":null},"comments":0,"created_at":"2018-02-05T23:54:12Z","updated_at":"2018-02-06T06:11:18Z","closed_at":null,"author_association":"NONE","body":"## The problem\r\n\r\nOne of the things we learned from last quarter's animation UX study is that participants had trouble wrapping their heads around the relationships between `AnimationController`, `Animation`, and `Tween`. They also felt the number of objects they needed to keep track of for a simple animation is overwhelming. The difficulty is partially related to the way the Controller-Animation relationship is declared in the current API. For example:\r\n\r\n```dart\r\nAnimationController controller = new AnimationController(); \r\nAnimation<Color> colorAnimation = \r\n    new Tween<Color> (begin: Colors.red, end: Colors.blue).animate(controller);\r\n```\r\nIn the above snippet, the chain of command is not obvious, since it was the Tween object that declared its controller rather than the other way around, leaving the impression that there are several independent objects the user needs to keep track of. Moreover, it's hard for the user to figure out what to do after creating the controller without making more trips to the documentation <sup>[1]</sup>.\r\n\r\n## The proposal \r\n\r\nThe main idea is to provide a way to discover APIs for building common animations by starting from an `AnimationController` object. The premise is that for the majority of users and especially new users, they don't need the full power and flexibility of the animation library to start building expressive animations. Thus, providing those users with a controller-centric view into the animation API makes building animations more tractable.\r\n\r\nSpecifically, I'd suggest adding a `makeAnimation(Animatable<T>)` method to AnimationController:\r\n\r\n```dart\r\nAnimationController controller = new AnimationController(); \r\nAnimation<Color> colorAnimation = controller.makeAnimation(\r\n    new Tween<Color> (begin: Colors.red, end: Colors.blue)\r\n);\r\n```\r\nIn addition, we should make this the recommended way to attach Animation objects to a controller in our sample code and tutorials, unless it is not sufficient for the specific use case. \r\n\r\nThe method `makeAnimation` will be discoverable through autocomplete on the controller object. However, the discoverability of Tween is still questionable, since the autocomplete box is likely to suggest `Animatable` which is an abstract class. We can either make the DartDoc of `Animatable` more explicitly point to `Tween` and `CurveTween`, the two classes implementing `Animatable`, or make autocomplete smarter. \r\n\r\n## References\r\n[1] For prior research on method placement's impact on API usability, see [Myers and Stylos (2006)](https://www.cs.cmu.edu/~NatProg/papers/Stylos2008APIObjectDesigns.pdf)."},"comment":{"url":"https://api.github.com/repos/flutter/flutter/issues/comments/363321382","html_url":"https://github.com/flutter/flutter/issues/14482#issuecomment-363321382","issue_url":"https://api.github.com/repos/flutter/flutter/issues/14482","id":363321382,"user":{"login":"Hixie","id":551196,"avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T06:11:18Z","updated_at":"2018-02-06T06:11:18Z","author_association":"CONTRIBUTOR","body":"How strongly are you attached to `makeAnimation`? The reason I ask is that `AnimationController` is itself an `Animation`, so it's not clear what it means exactly.\r\n\r\nMaybe \"drive\"? `animation = controller.drive(tween);`\r\n\r\nUnfortunately, `animate` and `chain` have conflicting meanings on `Animatable` already."}}
{"actor":{"display_login":"Hixie"}}