Function getSpringDuration

  • The spring easing function will only look smooth at certain durations, with certain parameters. This functions returns the optimal duration to create a smooth springy animation based on physics

    Parameters

    • spring-parameters: number[] = []

      mass = mass of object

      • stiffness = stiffness of spring
      • damping = amount to dampen spring motion
      • velocity = initial velocity of spring

    Returns number[]

    [ duration = optimal duration for spring easings, numPoints = optimal num. of points to represent the spring easing ]

    Note: Be very careful of only setting some of the spring parameters, it can cause errors if you are not careful

    Based on a function of the same name in animejs Thanks @jakearchibald for the help optimizing this

Generated using TypeDoc