Introduce new builder pattern and create DynamicSpringSource for MaterialSpring.
ClosedPublic

Authored by markwei on May 2 2017, 9:11 PM.

Details

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 https://github.com/material-motion/material-motion-android/issues/64

Diff Detail

Repository
rMDMSTREAMSANDROID reactive-motion-android
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
markwei created this revision.May 2 2017, 9:11 PM
Restricted Application added a reviewer: O2: Material Motion. · View Herald TranscriptMay 2 2017, 9:11 PM
Restricted Application added a project: Material Motion. · View Herald Transcript
Restricted Application added a reviewer: O6: Material Android platform reviewers. · View Herald Transcript
Restricted Application added a reviewer: Material Motion. · View Herald Transcript
Restricted Application failed to build Restricted Buildable!May 2 2017, 9:14 PM
markwei edited the summary of this revision. (Show Details)May 2 2017, 9:23 PM
markwei updated this revision to Diff 11010.May 2 2017, 9:28 PM

Move build() from Operation to SameTypeMapOperation.

Restricted Application completed building Restricted Buildable.May 2 2017, 9:28 PM
Restricted Application completed building Restricted Buildable.May 2 2017, 9:33 PM
featherless accepted this revision.May 3 2017, 11:01 AM
featherless added a subscriber: featherless.

Awesome. Am curious about the open question of how we'll resolve operators applied to velocity/position values.

This revision is now accepted and ready to land.May 3 2017, 11:01 AM
This revision was automatically updated to reflect the committed changes.