A spring is typically attached to a property, which will need an initial value before the spring activates. Presently, the spring only dispatches values when the spring is active (during an animation). This makes it difficult to use, because the initial value must be maintained in two places - in the property that a spring is writing to and as the initialValue for the spring itself. For instance:
const initialOpacity = .5; const opacitySpring = new NumericSpring(); opacitySpring.initialValue = initialOpacity; opacitySpring.value$.startWith(initialOpacity).subscribe(…)
With this change, writes to initialValue$ are passed through to value$. Thus, the example can be simplified to:
const opacitySpring = new NumericSpring(); opacitySpring.initialValue = .5; opacitySpring.value$.subscribe(…)
state$ is not affected by changes to initialValue$. It reflects whether a spring is in motion. Even when it's at rest, changes to initial value will be written to value$.