Skip to content

Conversation

@qchong
Copy link
Contributor

@qchong qchong commented Sep 29, 2016

Staged preview:

@abarth @HansMuller ptal.

output: web

- title: Animate Widgets
url: /animating-widgets/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the title and URL should match.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The titles in the sidebar (left-nav) are shortened by design, to make them easier to scan. The full title ('Animating Widgets') is shown when users open the link to that page.

available.

The [`flutter/animation`](https://docs.flutter.io/flutter/animation/animation-library.html)
package in the Flutter SDK provides APIs to create animation effects in user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically animation is a library rather than a package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to "library".

time) as it runs.

Based on the animation object’s properties at a specific frame, Flutter
dynamically modifies your widget visual appearence, and rebuilds the widget
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

widget's visual appearance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

To learn more about
using the other key classes in the
[`flutter/animation`](https://docs.flutter.io/flutter/animation/animation-library.html)
package, see the [Animations in Flutter](/animations) guide.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/package/library/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.


To render your widget with an animation, set one or more of the widget’s
members to the animation object, then use the animation’s value to decide how
to draw your object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

draw is kind of an unusual case. It's much more common to use the animation's value to decide how to build child widgets.

You can also specify a progression between two colors. For example:

```dart
final Tween colorTween =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop the final from all these example. Here I'd use the more specific ColorTween type.

interpolates between the double values of -200.0 to 0.0.

```dart
final Tween doubleTween = new Tween<double>(begin: -200.0, end: 0.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping the type parameter here is dodgy. Better to keep it in.

new ColorTween(begin: Colors.transparent, end: Colors.black54);
```

To apply a Tween to a given animation object, use the [`animate()`]()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra ()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Animation<int> alpha = new IntTween(
begin: 0,
end: 255)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whitespace is odd. I'd just put it all on one line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

useful for widgets that are already listening to the animation and hence
rebuilding whenever the animation changes value.
+ [`animate()`](http://docs.flutter.io/flutter/animation/Animatable/animate.html)
Animates the tween based on the animation object's properties. Rather than
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indent between these two bullets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

height: animation.value,
width: animation.value,
child: new AssetImage(
name: 'assets/flutter_logo.png',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these changed from web-based images to local images? With web-based images, readers can copy and paste the examples and they'll work. With local examples, readers have to create a project with the directory structure exactly right, and get the flutter.yaml file right, none of which is shown here. This was identified during usability testing of the original examples.

@qchong
Copy link
Contributor Author

qchong commented Nov 4, 2016

This PR has a dependency on flutter/flutter#1322 for improved animation code samples.

@eseidelGoogle
Copy link
Contributor

@sethladd maybe you can find a new owner for this?

@sethladd
Copy link
Contributor

sethladd commented Feb 9, 2017

Closing as stale. We can reopen if a new owner is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants