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 upperBound
lowerBound
Status Interface level Implementation level Library
Stable as of February 20, 2016 L2: Interaction creator L3: Stream creator material-motion
UpdatesCurrent StatusInitiation dateCompletion date
Renamed from max to upperBound Stable February 20, 2017
platformsrctests
Android View
iOS (Swift) View View
upperBound
upstream (Comparable)
maxValue (Comparable)
(Comparable) downstream

upperBound specification

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

Overview

upperBound emits either the incoming value or the provided maxValue, whichever is smaller.

Example usage

stream.upperBound(maxValue: 1)

upstream  maxValue  |  downstream
0.50      1         |  0.50
0.75      1         |  0.75
1.00      1         |  1.00
1.25      1         |  1.00
1.50      1         |  1.00

MVP

Expose a upperBound operator API

Use _map to implement the operator. Accept a Comparable type. Emit the result of min(upstreamValue, maxValue).

class MotionObservable<Comparable> {
  public func upperBound(maxValue: Comparable) -> MotionObservable<Comparable>