UNPKG

automation-events

Version:

A module which provides an implementation of an automation event list.

9 lines (6 loc) 391 B
import { ISetValueCurveAutomationEvent } from '../interfaces'; import { interpolateValue } from './interpolate-value'; export const getValueCurveValueAtTime = (time: number, { duration, startTime, values }: ISetValueCurveAutomationEvent): number => { const theoreticIndex = ((time - startTime) / duration) * (values.length - 1); return interpolateValue(values, theoreticIndex); };