38. Compose动画参数(持续更新)

206 阅读1分钟

弹簧参数

/**
 * Physics class contains a number of recommended configurations for physics animations.
 * 物理动画效果
 * 
 */
object Spring {
    /**
     * Stiffness constant for extremely stiff spring
     * 极硬弹簧
     */
    const val StiffnessHigh = 10_000f

    /**
     * Stiffness constant for medium stiff spring. This is the default stiffness for spring
     * force.
     * 中等硬度弹簧
     */
    const val StiffnessMedium = 1500f

    /**
     * Stiffness constant for medium-low stiff spring. This is the default stiffness for springs
     * used in enter/exit transitions.
     * 中低刚度弹簧 通常用于进出动画
     */
    const val StiffnessMediumLow = 400f

    /**
     * Stiffness constant for a spring with low stiffness.
     * 刚度较低
     */
    const val StiffnessLow = 200f

    /**
     * Stiffness constant for a spring with very low stiffness.
     * 刚度非常低
     */
    const val StiffnessVeryLow = 50f

    /**
     * Damping ratio for a very bouncy spring. Note for under-damped springs
     * (i.e. damping ratio < 1), the lower the damping ratio, the more bouncy the spring.
     * 非常有弹性的弹簧的阻尼比
     * 注意欠阻尼弹簧(即阻尼比 < 1),越低
      *阻尼比,弹簧越有弹性。
     */
    const val DampingRatioHighBouncy = 0.2f

    /**
     * Damping ratio for a medium bouncy spring. This is also the default damping ratio for
     * spring force. Note for under-damped springs (i.e. damping ratio < 1), the lower the
     * damping ratio, the more bouncy the spring.
     * 中等弹性弹簧的阻尼比。
     */
    const val DampingRatioMediumBouncy = 0.5f

    /**
     * Damping ratio for a spring with low bounciness. Note for under-damped springs
     * (i.e. damping ratio < 1), the lower the damping ratio, the higher the bounciness.
     * 低弹性弹簧的阻尼比
     */
    const val DampingRatioLowBouncy = 0.75f

    /**
     * Damping ratio for a spring with no bounciness. This damping ratio will create a
     * critically damped spring that returns to equilibrium within the shortest amount of time
     * without oscillating.
     * 没有弹性的弹簧的阻尼比
     */
    const val DampingRatioNoBouncy = 1f

    /**
     * Default cutoff for rounding off physics based animations
     * 四舍五入基于物理的动画的默认截止
     */
    const val DefaultDisplacementThreshold = 0.01f
}