Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 44x 44x 44x 44x 44x 38x 1x 1x 1x 37x 33x 33x 4x 44x 31x | import { invariant } from "hey-listen" import { cubicBezier } from "popmotion" import { linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut, } from "popmotion" import { Easing } from "../../types" const easingLookup = { linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut, } export const easingDefinitionToFunction = (definition: Easing) => { if (Array.isArray(definition)) { // If cubic bezier definition, create bezier curve invariant( definition.length === 4, `Cubic bezier arrays must contain four numerical values.` ) const [x1, y1, x2, y2] = definition return cubicBezier(x1, y1, x2, y2) } else if (typeof definition === "string") { // Else lookup from table invariant( easingLookup[definition] !== undefined, `Invalid easing type '${definition}'` ) return easingLookup[definition] } return definition } export const isEasingArray = (ease: any): ease is Easing[] => { return Array.isArray(ease) && typeof ease[0] !== "number" } |