Capítulo 47 de 411

Chapter 47: Timeline.duration()

Core Idea

duration() gets the timeline's total duration, or (as a setter) adjusts its timeScale so it fits the specified duration.

Reference Tables

ParameterTypeDefaultDescription
valueNumberNaNomit to get; pass to fit the timeline into that many seconds

Returns: Number (getter) or self (setter).

Code Examples

tl.duration(); // total seconds
tl.duration(2); // rescale timeScale so the whole thing takes exactly 2s

Connects To

  • Timeline.timeScale(): what setting duration actually manipulates under the hood.