Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Deprecate physics-android and use DynamicAnimation in supportlib #64

Open
pingpongboss opened this issue Mar 30, 2017 · 1 comment
Open
Assignees

Comments

@pingpongboss
Copy link
Contributor

No description provided.

@pingpongboss
Copy link
Contributor Author

SpringAnimation requires the caller to pass in the View target and ViewProperty property ahead of time. The API looks like this:

SpringAnimation spring = new SpringAnimation(viewTarget, DynamicAnimation.X);
spring.start();

The SpringAnimation is responsible for writing to the target's property on every time step.

This is not compatible with Android's current data pipeline setup, where the writing's responsibility lies with the runtime:

MotionObservable stream = source().operator().operator();
runtime.write(stream, target, property);

However, it is similar to the coreAnimation channel introduced in material-motion-swift.

@pingpongboss pingpongboss self-assigned this Apr 19, 2017
pingpongboss pushed a commit that referenced this issue May 3, 2017
…rialSpring.

Summary:
This is similar to the coreanimation pattern in material-motion-swift.
This is a useful pattern for animation systems that require the target object and property to be provided up-front.
For example, off-thread animation systems require this.

A new `build` channel is added to MotionObservable.
An interaction that uses an off-thread animation system would use the `build` channel rather than the `next` channel.

This `build` channel passes along:
 1. a MotionBuilder<T> object
 2. a T[] of config values

The MotionBuilder<T> can take a T[] of config values to create some type of motion, and is created by the interaction.
The T[] is transformed by constraint operators as it is passed down the `build` channel.
Only specific T->T operators can transform this T[].

If a stream given to `MotionRuntime.write(stream, property)` has an active `build` channel,
the MotionBuilder<T> will be given the transformed T[] and the property.

The new DynamicSpringSource and DynamicSpringBuilder uses this builder pattern.
DynamicSpringBuilder supports writing T values to Property<T> by using a TypeVectorizer to break a T value into multiple Float values.
Each float value is animated by a separate SpringAnimation.

Part of #64

Reviewers: O2 Material Motion, O6 Material Android platform reviewers, #material_motion, featherless

Reviewed By: O2 Material Motion, #material_motion, featherless

Subscribers: featherless

Tags: #material_motion

Differential Revision: http://codereview.cc/D3150
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant