MCPcopy
hub / github.com/animatedjs/animated / constructor

Method constructor

src/SpringAnimation.js:57–88  ·  view source on GitHub ↗
(
    config: SpringAnimationConfigSingle,
  )

Source from the content-addressed store, hash-verified

55 _animationFrame: any;
56
57 constructor(
58 config: SpringAnimationConfigSingle,
59 ) {
60 super();
61
62 this._overshootClamping = withDefault(config.overshootClamping, false);
63 this._restDisplacementThreshold = withDefault(config.restDisplacementThreshold, 0.001);
64 this._restSpeedThreshold = withDefault(config.restSpeedThreshold, 0.001);
65 this._initialVelocity = config.velocity;
66 this._lastVelocity = withDefault(config.velocity, 0);
67 this._toValue = config.toValue;
68 this.__isInteraction = config.isInteraction !== undefined ? config.isInteraction : true;
69
70 var springConfig;
71 if (config.bounciness !== undefined || config.speed !== undefined) {
72 invariant(
73 config.tension === undefined && config.friction === undefined,
74 'You can only define bounciness/speed or tension/friction but not both',
75 );
76 springConfig = SpringConfig.fromBouncinessAndSpeed(
77 withDefault(config.bounciness, 8),
78 withDefault(config.speed, 12),
79 );
80 } else {
81 springConfig = SpringConfig.fromOrigamiTensionAndFriction(
82 withDefault(config.tension, 40),
83 withDefault(config.friction, 7),
84 );
85 }
86 this._tension = springConfig.tension;
87 this._friction = springConfig.friction;
88 }
89
90 start(
91 fromValue: number,

Callers

nothing calls this directly

Calls 1

withDefaultFunction · 0.85

Tested by

no test coverage detected