Material Motion Exploring solutions that will empower creators with the tools needed to describe and implement rich, interactive motion on any platform. Edit this page · History
$._map rewriteTo
Status Interface level Implementation level Library
Stable as of February 20, 2016 L2: Interaction creator L3: Stream creator material-motion
platformsrctests
Android View
iOS (Swift) View View
JavaScript View View
rewriteTo
upstream (T)
(U) downstream

rewriteTo specification

This is the engineering specification for the MotionObservable operator: rewriteTo.

Overview

rewriteTo emits the provided value every time it receives a new upstream value.

Example usage:

stream.rewriteTo(100)

upstream  value  |  downstream
 0.50     100    |  100
 0.25     100    |  100
 0.00     100    |  100
-0.25     100    |  100
-0.50     100    |  100

MVP

Expose a rewriteTo operator API

Use _map to implement the operator. Accept a constant of type U. Emit this value when a new upstream value is received.

class MotionObservable {
  public func rewriteTo<U>(_ value: U) -> MotionObservable<U>