asFrames method

int asFrames(
  1. int parentDurationInFrames,
  2. int fps
)

Converts this time value to a number of frames.

The parentDurationInFrames and fps are required in case this time is relative.

Implementation

int asFrames(int parentDurationInFrames, int fps) {
  return map(
    (frames) => frames,
    (percent) => (percent * parentDurationInFrames).round(),
    (duration) => ((duration.inMilliseconds / 1000) * fps).round(),
  );
}