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
$._nextOperator threshold
thresholdRange
rewrite
Status Interface level Implementation level Library
Stable as of February 21, 2017 L2: Interaction creator L3: Stream creator material-motion
UpdatesCurrent StatusInitiation dateCompletion date
ThresholdEvent renamed to ThresholdSide. Dropped when- prefix. Stable March 22, 2017
platformsrctests
Android View
iOS (Swift) View View
threshold
upstream (number)
threshold (number)
(ThresholdSide) downstream

threshold specification

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

Overview

threshold emits a ThresholdEvent based on the incoming value’s position around a threshold.

Example usage

stream.threshold(50)

upstream position  |  downstream
20       50        |  .below
50       50        |  .within
60       50        |  .above

MVP

Expose a ThresholdSide enum type

public enum ThresholdSide {
  case below
  case within
  case above
}

Expose a threshold operator API

Use _nextOperator to implement the operator. Accept a single position value.

class MotionObservable<number> {
  public func threshold<U>(_ threshold: number) -> MotionObservable<ThresholdSide>