summaryrefslogtreecommitdiff
path: root/components/config.ts
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-07-26 19:00:53 +0200
committerThomas F. K. Jorna <[email protected]>2021-07-26 19:00:53 +0200
commitc707b3af917af40a9a06639d217937bfecef9ecd (patch)
treeddef5efa34f08c48c496fc06b03f00825048ab20 /components/config.ts
parent654e71bfacc273a964a5b620e98bd504cef85460 (diff)
fixed a single typescript error
Diffstat (limited to 'components/config.ts')
-rw-r--r--components/config.ts31
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
-}