npm i activity-envelope
ActivityEnvelope is an activity monitor of sorts, which can be used to drive visualizations or other responsive features in an interactive experience. It supports both pull and push models; the linearValue
getter can be used to poll a calculated activity level, or external code can subscribe to phase change events.
The ActivityEnvelope is designed similarly to the classic envelope generators used in synthesizers, with a key difference: "sustain" is not a fixed level, but a fixed duration. The sustain phase is intended to model the period of time in which a new impulse will not change the activity level, but instead will further delay the release phase.
Find a demo app at the root level of the repository here.