MCPcopy
hub / github.com/julianshapiro/velocity / validateEasing

Function validateEasing

velocity.js:642–672  ·  view source on GitHub ↗

* Validate a easing option.

(value, duration, noError)

Source from the content-addressed store, hash-verified

640 * Validate a <code>easing</code> option.
641 */
642 function validateEasing(value, duration, noError) {
643 if (isString(value)) {
644 // Named easing
645 return Easings[value];
646 }
647 if (isFunction(value)) {
648 return value;
649 }
650 // TODO: We should only do these if the correct function exists - don't force loading.
651 if (Array.isArray(value)) {
652 if (value.length === 1) {
653 // Steps
654 return generateStep(value[0]);
655 }
656 if (value.length === 2) {
657 // springRK4 must be passed the animation's duration.
658 // Note: If the springRK4 array contains non-numbers,
659 // generateSpringRK4() returns an easing function generated with
660 // default tension and friction values.
661 return generateSpringRK4(value[0], value[1], duration);
662 }
663 if (value.length === 4) {
664 // Note: If the bezier array contains non-numbers, generateBezier()
665 // returns undefined.
666 return generateBezier.apply(null, value) || false;
667 }
668 }
669 if (value != null && !noError) {
670 console.error("VelocityJS: Trying to set 'easing' to an invalid value:", value);
671 }
672 }
673 /**
674 * Validate a <code>fpsLimit</code> option.
675 */

Callers 6

velocity.jsFile · 0.70
expandPropertiesFunction · 0.70
returnStringTypeFunction · 0.70
tweenActionFunction · 0.70
registerSequenceFunction · 0.70
Velocity$1Function · 0.70

Calls 4

isStringFunction · 0.70
isFunctionFunction · 0.70
generateStepFunction · 0.70
generateSpringRK4Function · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…