diff options
Diffstat (limited to 'components/config.ts')
-rw-r--r-- | components/config.ts | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/components/config.ts b/components/config.ts index 7cfe85a..2153445 100644 --- a/components/config.ts +++ b/components/config.ts @@ -1,4 +1,16 @@ import { Easing } from '@tweenjs/tween.js' +const options: string[] = [] +const algorithms: { [name: string]: (percent: number) => number } = {} +for (let type in Easing) { + for (let mode in (Easing as any)[type]) { + let name = type + mode + if (name === 'LinearNone') { + name = 'Linear' + } + options.push(name) + algorithms[name] = (Easing as any)[type][mode] + } +} export const initialPhysics = { enabled: true, @@ -33,8 +45,8 @@ export const initialPhysics = { highlightLinkSize: 2, highlightAnim: false, animationSpeed: 250, - algorithms: getAlgos(false), - algorithmOptions: getAlgos(true), + algorithms: options, + algorithmOptions: algorithms, algorithmName: 'CubicOut', orphans: false, follow: 'Local', @@ -48,18 +60,3 @@ export const initialFilter = { links: [], date: [], } - -function getAlgos(option?: boolean) { - const options: string[] = [] - const algorithms: { [name: string]: (percent: number) => number } = {} - for (let type in Easing) { - for (let mode in (Easing as any)[type]) { - let name = type + mode - if (name === 'LinearNone') { - name = 'Linear' - } - option ? options.push(name) : (algorithms[name] = (Easing as any)[type][mode]) - } - } - return option ? options : algorithms -} |