@visactor/vrender-animate 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -0
- package/cjs/animate-extension.d.ts +15 -0
- package/cjs/animate-extension.js +46 -0
- package/cjs/animate-extension.js.map +1 -0
- package/cjs/animate.d.ts +71 -0
- package/cjs/animate.js +210 -0
- package/cjs/animate.js.map +1 -0
- package/cjs/custom/clip-graphic.d.ts +53 -0
- package/cjs/custom/clip-graphic.js +146 -0
- package/cjs/custom/clip-graphic.js.map +1 -0
- package/cjs/custom/clip.d.ts +13 -0
- package/cjs/custom/clip.js +24 -0
- package/cjs/custom/clip.js.map +1 -0
- package/cjs/custom/common.d.ts +22 -0
- package/cjs/custom/common.js +58 -0
- package/cjs/custom/common.js.map +1 -0
- package/cjs/custom/custom-animate.d.ts +15 -0
- package/cjs/custom/custom-animate.js +25 -0
- package/cjs/custom/custom-animate.js.map +1 -0
- package/cjs/custom/fade.d.ts +13 -0
- package/cjs/custom/fade.js +24 -0
- package/cjs/custom/fade.js.map +1 -0
- package/cjs/custom/group-fade.d.ts +16 -0
- package/cjs/custom/group-fade.js +66 -0
- package/cjs/custom/group-fade.js.map +1 -0
- package/cjs/custom/growAngle.d.ts +37 -0
- package/cjs/custom/growAngle.js +140 -0
- package/cjs/custom/growAngle.js.map +1 -0
- package/cjs/custom/growCenter.d.ts +17 -0
- package/cjs/custom/growCenter.js +161 -0
- package/cjs/custom/growCenter.js.map +1 -0
- package/cjs/custom/growHeight.d.ts +36 -0
- package/cjs/custom/growHeight.js +154 -0
- package/cjs/custom/growHeight.js.map +1 -0
- package/cjs/custom/growPoints.d.ts +52 -0
- package/cjs/custom/growPoints.js +227 -0
- package/cjs/custom/growPoints.js.map +1 -0
- package/cjs/custom/growRadius.d.ts +41 -0
- package/cjs/custom/growRadius.js +113 -0
- package/cjs/custom/growRadius.js.map +1 -0
- package/cjs/custom/growWidth.d.ts +36 -0
- package/cjs/custom/growWidth.js +154 -0
- package/cjs/custom/growWidth.js.map +1 -0
- package/cjs/custom/input-text.d.ts +29 -0
- package/cjs/custom/input-text.js +45 -0
- package/cjs/custom/input-text.js.map +1 -0
- package/cjs/custom/number.d.ts +25 -0
- package/cjs/custom/number.js +102 -0
- package/cjs/custom/number.js.map +1 -0
- package/cjs/custom/register.d.ts +1 -0
- package/cjs/custom/register.js +35 -0
- package/cjs/custom/register.js.map +1 -0
- package/cjs/custom/scale-in.d.ts +13 -0
- package/cjs/custom/scale-in.js +57 -0
- package/cjs/custom/scale-in.js.map +1 -0
- package/cjs/custom/scale.d.ts +20 -0
- package/cjs/custom/scale.js +106 -0
- package/cjs/custom/scale.js.map +1 -0
- package/cjs/custom/sphere.d.ts +20 -0
- package/cjs/custom/sphere.js +26 -0
- package/cjs/custom/sphere.js.map +1 -0
- package/cjs/custom/state.d.ts +13 -0
- package/cjs/custom/state.js +25 -0
- package/cjs/custom/state.js.map +1 -0
- package/cjs/custom/tag-points.d.ts +26 -0
- package/cjs/custom/tag-points.js +81 -0
- package/cjs/custom/tag-points.js.map +1 -0
- package/cjs/custom/update.d.ts +14 -0
- package/cjs/custom/update.js +26 -0
- package/cjs/custom/update.js.map +1 -0
- package/cjs/executor/animate-executor.d.ts +36 -0
- package/cjs/executor/animate-executor.js +177 -0
- package/cjs/executor/animate-executor.js.map +1 -0
- package/cjs/executor/executor.d.ts +69 -0
- package/cjs/executor/executor.js +6 -0
- package/cjs/executor/executor.js.map +1 -0
- package/cjs/index.d.ts +25 -0
- package/cjs/index.js +214 -0
- package/cjs/index.js.map +1 -0
- package/cjs/interpolate/executor.d.ts +66 -0
- package/cjs/interpolate/executor.js +6 -0
- package/cjs/interpolate/executor.js.map +1 -0
- package/cjs/interpolate/number.d.ts +1 -0
- package/cjs/interpolate/number.js +10 -0
- package/cjs/interpolate/number.js.map +1 -0
- package/cjs/interpolate/store.d.ts +32 -0
- package/cjs/interpolate/store.js +96 -0
- package/cjs/interpolate/store.js.map +1 -0
- package/cjs/intreface/animate.d.ts +91 -0
- package/cjs/intreface/animate.js +10 -0
- package/cjs/intreface/animate.js.map +1 -0
- package/cjs/intreface/easing.d.ts +3 -0
- package/cjs/intreface/easing.js +6 -0
- package/cjs/intreface/easing.js.map +1 -0
- package/cjs/intreface/state.d.ts +35 -0
- package/cjs/intreface/state.js +6 -0
- package/cjs/intreface/state.js.map +1 -0
- package/cjs/intreface/ticker.d.ts +37 -0
- package/cjs/intreface/ticker.js +10 -0
- package/cjs/intreface/ticker.js.map +1 -0
- package/cjs/intreface/timeline.d.ts +17 -0
- package/cjs/intreface/timeline.js +6 -0
- package/cjs/intreface/timeline.js.map +1 -0
- package/cjs/intreface/type.d.ts +13 -0
- package/cjs/intreface/type.js +15 -0
- package/cjs/intreface/type.js.map +1 -0
- package/cjs/register.d.ts +1 -0
- package/cjs/register.js +19 -0
- package/cjs/register.js.map +1 -0
- package/cjs/state/animation-state-machine.d.ts +22 -0
- package/cjs/state/animation-state-machine.js +53 -0
- package/cjs/state/animation-state-machine.js.map +1 -0
- package/cjs/state/animation-state-queue.d.ts +24 -0
- package/cjs/state/animation-state-queue.js +66 -0
- package/cjs/state/animation-state-queue.js.map +1 -0
- package/cjs/state/animation-state-registry.d.ts +14 -0
- package/cjs/state/animation-state-registry.js +53 -0
- package/cjs/state/animation-state-registry.js.map +1 -0
- package/cjs/state/animation-state.d.ts +25 -0
- package/cjs/state/animation-state.js +80 -0
- package/cjs/state/animation-state.js.map +1 -0
- package/cjs/state/animation-states-registry.d.ts +17 -0
- package/cjs/state/animation-states-registry.js +95 -0
- package/cjs/state/animation-states-registry.js.map +1 -0
- package/cjs/state/graphic-extension.d.ts +12 -0
- package/cjs/state/graphic-extension.js +37 -0
- package/cjs/state/graphic-extension.js.map +1 -0
- package/cjs/state/index.d.ts +3 -0
- package/cjs/state/index.js +22 -0
- package/cjs/state/index.js.map +1 -0
- package/cjs/state/types.d.ts +11 -0
- package/cjs/state/types.js +6 -0
- package/cjs/state/types.js.map +1 -0
- package/cjs/step.d.ts +49 -0
- package/cjs/step.js +124 -0
- package/cjs/step.js.map +1 -0
- package/cjs/ticker/default-ticker.d.ts +39 -0
- package/cjs/ticker/default-ticker.js +133 -0
- package/cjs/ticker/default-ticker.js.map +1 -0
- package/cjs/ticker/manual-ticker.d.ts +6 -0
- package/cjs/ticker/manual-ticker.js +37 -0
- package/cjs/ticker/manual-ticker.js.map +1 -0
- package/cjs/timeline.d.ts +34 -0
- package/cjs/timeline.js +84 -0
- package/cjs/timeline.js.map +1 -0
- package/cjs/utils/easing-func.d.ts +1 -0
- package/cjs/utils/easing-func.js +16 -0
- package/cjs/utils/easing-func.js.map +1 -0
- package/cjs/utils/easing.d.ts +49 -0
- package/cjs/utils/easing.js +141 -0
- package/cjs/utils/easing.js.map +1 -0
- package/dist/index.es.js +3824 -0
- package/es/animate-extension.d.ts +15 -0
- package/es/animate-extension.js +42 -0
- package/es/animate-extension.js.map +1 -0
- package/es/animate.d.ts +71 -0
- package/es/animate.js +207 -0
- package/es/animate.js.map +1 -0
- package/es/custom/clip-graphic.d.ts +53 -0
- package/es/custom/clip-graphic.js +134 -0
- package/es/custom/clip-graphic.js.map +1 -0
- package/es/custom/clip.d.ts +13 -0
- package/es/custom/clip.js +14 -0
- package/es/custom/clip.js.map +1 -0
- package/es/custom/common.d.ts +22 -0
- package/es/custom/common.js +48 -0
- package/es/custom/common.js.map +1 -0
- package/es/custom/custom-animate.d.ts +15 -0
- package/es/custom/custom-animate.js +17 -0
- package/es/custom/custom-animate.js.map +1 -0
- package/es/custom/fade.d.ts +13 -0
- package/es/custom/fade.js +14 -0
- package/es/custom/fade.js.map +1 -0
- package/es/custom/group-fade.d.ts +16 -0
- package/es/custom/group-fade.js +56 -0
- package/es/custom/group-fade.js.map +1 -0
- package/es/custom/growAngle.d.ts +37 -0
- package/es/custom/growAngle.js +132 -0
- package/es/custom/growAngle.js.map +1 -0
- package/es/custom/growCenter.d.ts +17 -0
- package/es/custom/growCenter.js +155 -0
- package/es/custom/growCenter.js.map +1 -0
- package/es/custom/growHeight.d.ts +36 -0
- package/es/custom/growHeight.js +144 -0
- package/es/custom/growHeight.js.map +1 -0
- package/es/custom/growPoints.d.ts +52 -0
- package/es/custom/growPoints.js +219 -0
- package/es/custom/growPoints.js.map +1 -0
- package/es/custom/growRadius.d.ts +41 -0
- package/es/custom/growRadius.js +105 -0
- package/es/custom/growRadius.js.map +1 -0
- package/es/custom/growWidth.d.ts +36 -0
- package/es/custom/growWidth.js +144 -0
- package/es/custom/growWidth.js.map +1 -0
- package/es/custom/input-text.d.ts +29 -0
- package/es/custom/input-text.js +37 -0
- package/es/custom/input-text.js.map +1 -0
- package/es/custom/number.d.ts +25 -0
- package/es/custom/number.js +94 -0
- package/es/custom/number.js.map +1 -0
- package/es/custom/register.d.ts +1 -0
- package/es/custom/register.js +39 -0
- package/es/custom/register.js.map +1 -0
- package/es/custom/scale-in.d.ts +13 -0
- package/es/custom/scale-in.js +49 -0
- package/es/custom/scale-in.js.map +1 -0
- package/es/custom/scale.d.ts +20 -0
- package/es/custom/scale.js +96 -0
- package/es/custom/scale.js.map +1 -0
- package/es/custom/sphere.d.ts +20 -0
- package/es/custom/sphere.js +20 -0
- package/es/custom/sphere.js.map +1 -0
- package/es/custom/state.d.ts +13 -0
- package/es/custom/state.js +17 -0
- package/es/custom/state.js.map +1 -0
- package/es/custom/tag-points.d.ts +26 -0
- package/es/custom/tag-points.js +77 -0
- package/es/custom/tag-points.js.map +1 -0
- package/es/custom/update.d.ts +14 -0
- package/es/custom/update.js +18 -0
- package/es/custom/update.js.map +1 -0
- package/es/executor/animate-executor.d.ts +36 -0
- package/es/executor/animate-executor.js +169 -0
- package/es/executor/animate-executor.js.map +1 -0
- package/es/executor/executor.d.ts +69 -0
- package/es/executor/executor.js +2 -0
- package/es/executor/executor.js.map +1 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +50 -0
- package/es/index.js.map +1 -0
- package/es/interpolate/executor.d.ts +66 -0
- package/es/interpolate/executor.js +2 -0
- package/es/interpolate/executor.js.map +1 -0
- package/es/interpolate/number.d.ts +1 -0
- package/es/interpolate/number.js +4 -0
- package/es/interpolate/number.js.map +1 -0
- package/es/interpolate/store.d.ts +32 -0
- package/es/interpolate/store.js +88 -0
- package/es/interpolate/store.js.map +1 -0
- package/es/intreface/animate.d.ts +91 -0
- package/es/intreface/animate.js +6 -0
- package/es/intreface/animate.js.map +1 -0
- package/es/intreface/easing.d.ts +3 -0
- package/es/intreface/easing.js +2 -0
- package/es/intreface/easing.js.map +1 -0
- package/es/intreface/state.d.ts +35 -0
- package/es/intreface/state.js +2 -0
- package/es/intreface/state.js.map +1 -0
- package/es/intreface/ticker.d.ts +37 -0
- package/es/intreface/ticker.js +6 -0
- package/es/intreface/ticker.js.map +1 -0
- package/es/intreface/timeline.d.ts +17 -0
- package/es/intreface/timeline.js +2 -0
- package/es/intreface/timeline.js.map +1 -0
- package/es/intreface/type.d.ts +13 -0
- package/es/intreface/type.js +14 -0
- package/es/intreface/type.js.map +1 -0
- package/es/register.d.ts +1 -0
- package/es/register.js +20 -0
- package/es/register.js.map +1 -0
- package/es/state/animation-state-machine.d.ts +22 -0
- package/es/state/animation-state-machine.js +47 -0
- package/es/state/animation-state-machine.js.map +1 -0
- package/es/state/animation-state-queue.d.ts +24 -0
- package/es/state/animation-state-queue.js +58 -0
- package/es/state/animation-state-queue.js.map +1 -0
- package/es/state/animation-state-registry.d.ts +14 -0
- package/es/state/animation-state-registry.js +45 -0
- package/es/state/animation-state-registry.js.map +1 -0
- package/es/state/animation-state.d.ts +25 -0
- package/es/state/animation-state.js +72 -0
- package/es/state/animation-state.js.map +1 -0
- package/es/state/animation-states-registry.d.ts +17 -0
- package/es/state/animation-states-registry.js +87 -0
- package/es/state/animation-states-registry.js.map +1 -0
- package/es/state/graphic-extension.d.ts +12 -0
- package/es/state/graphic-extension.js +29 -0
- package/es/state/graphic-extension.js.map +1 -0
- package/es/state/index.d.ts +3 -0
- package/es/state/index.js +6 -0
- package/es/state/index.js.map +1 -0
- package/es/state/types.d.ts +11 -0
- package/es/state/types.js +2 -0
- package/es/state/types.js.map +1 -0
- package/es/step.d.ts +49 -0
- package/es/step.js +120 -0
- package/es/step.js.map +1 -0
- package/es/ticker/default-ticker.d.ts +39 -0
- package/es/ticker/default-ticker.js +129 -0
- package/es/ticker/default-ticker.js.map +1 -0
- package/es/ticker/manual-ticker.d.ts +6 -0
- package/es/ticker/manual-ticker.js +29 -0
- package/es/ticker/manual-ticker.js.map +1 -0
- package/es/timeline.d.ts +34 -0
- package/es/timeline.js +79 -0
- package/es/timeline.js.map +1 -0
- package/es/utils/easing-func.d.ts +1 -0
- package/es/utils/easing-func.js +8 -0
- package/es/utils/easing-func.js.map +1 -0
- package/es/utils/easing.d.ts +49 -0
- package/es/utils/easing.js +134 -0
- package/es/utils/easing.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/executor/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\nimport type { ACustomAnimate } from '../custom/custom-animate';\n\nexport type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\ninterface IAnimationParameters {\n [key: string]: any;\n}\n\n/**\n * 动画 channel 配置\n */\nexport type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;\n\n/**\n * 动画 channel 属性配置\n */\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\n\n/**\n * 动画 channel 插值器\n */\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IGraphic,\n parameters: IAnimationParameters\n) => boolean | void;\n\n/**\n * 动画 custom 构造器\n */\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationTimeSlice {\n /** 动画效果 */\n effects: IAnimationEffect | IAnimationEffect[];\n /** 动画时长 */\n duration?: MarkFunctionValueType<number>;\n /** 延迟delay后执行动画 */\n delay?: MarkFunctionValueType<number>;\n /** effect动画后再延迟delayAfter结束这个周期 */\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n /** encode 计算图元最终状态时是否忽略循环动画 */\n ignoreLoopFinalAttributes?: boolean;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 to 配置(和channel互斥,如果同时设置,以to为准) */\n to?: Record<string, any>;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** 动画 delay 配置 */\n delay?: MarkFunctionValueType<number>;\n /** 动画 delayAfter 配置 */\n delayAfter?: MarkFunctionValueType<number>;\n /** 动画 duration 配置 */\n duration?: MarkFunctionValueType<number>;\n /** 动画 oneByOne 配置(是否依次执行) */\n oneByOne?: MarkFunctionValueType<boolean | number>;\n /** 动画 startTime 配置 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画 totalTime 配置(如果有循环,只算一个周期) */\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n /** 动画优先级 */\n priority?: number;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n /** 动画优先级 */\n priority?: number;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n"]}
|
package/cjs/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './intreface/animate';
|
|
2
|
+
export * from './intreface/timeline';
|
|
3
|
+
export * from './intreface/easing';
|
|
4
|
+
export * from './intreface/type';
|
|
5
|
+
export { Animate } from './animate';
|
|
6
|
+
export { DefaultTimeline } from './timeline';
|
|
7
|
+
export { ManualTicker } from './ticker/manual-ticker';
|
|
8
|
+
export { DefaultTicker } from './ticker/default-ticker';
|
|
9
|
+
export { Step } from './step';
|
|
10
|
+
export * from './utils/easing-func';
|
|
11
|
+
export { registerAnimate } from './register';
|
|
12
|
+
export { ACustomAnimate } from './custom/custom-animate';
|
|
13
|
+
export { IncreaseCount } from './custom/number';
|
|
14
|
+
export { InputText } from './custom/input-text';
|
|
15
|
+
export { ClipGraphicAnimate, ClipAngleAnimate, ClipRadiusAnimate, ClipDirectionAnimate } from './custom/clip-graphic';
|
|
16
|
+
export { TagPointsUpdate } from './custom/tag-points';
|
|
17
|
+
export { GroupFadeIn, GroupFadeOut } from './custom/group-fade';
|
|
18
|
+
export { RotateBySphereAnimate } from './custom/sphere';
|
|
19
|
+
export { AnimateExecutor } from './executor/animate-executor';
|
|
20
|
+
export { registerCustomAnimate } from './custom/register';
|
|
21
|
+
export * from './state';
|
|
22
|
+
export { AnimationTransitionRegistry } from './state/animation-states-registry';
|
|
23
|
+
export { transitionRegistry } from './state/animation-states-registry';
|
|
24
|
+
export { AnimationStateManager } from './state/animation-state';
|
|
25
|
+
export { AnimationStateStore } from './state/animation-state';
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
4
|
+
void 0 === k2 && (k2 = k);
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
get: function() {
|
|
9
|
+
return m[k];
|
|
10
|
+
}
|
|
11
|
+
}), Object.defineProperty(o, k2, desc);
|
|
12
|
+
} : function(o, m, k, k2) {
|
|
13
|
+
void 0 === k2 && (k2 = k), o[k2] = m[k];
|
|
14
|
+
}), __exportStar = this && this.__exportStar || function(m, exports) {
|
|
15
|
+
for (var p in m) "default" === p || Object.prototype.hasOwnProperty.call(exports, p) || __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), exports.AnimationStateStore = exports.AnimationStateManager = exports.transitionRegistry = exports.AnimationTransitionRegistry = exports.registerCustomAnimate = exports.AnimateExecutor = exports.RotateBySphereAnimate = exports.GroupFadeOut = exports.GroupFadeIn = exports.TagPointsUpdate = exports.ClipDirectionAnimate = exports.ClipRadiusAnimate = exports.ClipAngleAnimate = exports.ClipGraphicAnimate = exports.InputText = exports.IncreaseCount = exports.ACustomAnimate = exports.registerAnimate = exports.Step = exports.DefaultTicker = exports.ManualTicker = exports.DefaultTimeline = exports.Animate = void 0,
|
|
21
|
+
__exportStar(require("./intreface/animate"), exports), __exportStar(require("./intreface/timeline"), exports),
|
|
22
|
+
__exportStar(require("./intreface/easing"), exports), __exportStar(require("./intreface/type"), exports);
|
|
23
|
+
|
|
24
|
+
var animate_1 = require("./animate");
|
|
25
|
+
|
|
26
|
+
Object.defineProperty(exports, "Animate", {
|
|
27
|
+
enumerable: !0,
|
|
28
|
+
get: function() {
|
|
29
|
+
return animate_1.Animate;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var timeline_1 = require("./timeline");
|
|
34
|
+
|
|
35
|
+
Object.defineProperty(exports, "DefaultTimeline", {
|
|
36
|
+
enumerable: !0,
|
|
37
|
+
get: function() {
|
|
38
|
+
return timeline_1.DefaultTimeline;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var manual_ticker_1 = require("./ticker/manual-ticker");
|
|
43
|
+
|
|
44
|
+
Object.defineProperty(exports, "ManualTicker", {
|
|
45
|
+
enumerable: !0,
|
|
46
|
+
get: function() {
|
|
47
|
+
return manual_ticker_1.ManualTicker;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var default_ticker_1 = require("./ticker/default-ticker");
|
|
52
|
+
|
|
53
|
+
Object.defineProperty(exports, "DefaultTicker", {
|
|
54
|
+
enumerable: !0,
|
|
55
|
+
get: function() {
|
|
56
|
+
return default_ticker_1.DefaultTicker;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
var step_1 = require("./step");
|
|
61
|
+
|
|
62
|
+
Object.defineProperty(exports, "Step", {
|
|
63
|
+
enumerable: !0,
|
|
64
|
+
get: function() {
|
|
65
|
+
return step_1.Step;
|
|
66
|
+
}
|
|
67
|
+
}), __exportStar(require("./utils/easing-func"), exports);
|
|
68
|
+
|
|
69
|
+
var register_1 = require("./register");
|
|
70
|
+
|
|
71
|
+
Object.defineProperty(exports, "registerAnimate", {
|
|
72
|
+
enumerable: !0,
|
|
73
|
+
get: function() {
|
|
74
|
+
return register_1.registerAnimate;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
var custom_animate_1 = require("./custom/custom-animate");
|
|
79
|
+
|
|
80
|
+
Object.defineProperty(exports, "ACustomAnimate", {
|
|
81
|
+
enumerable: !0,
|
|
82
|
+
get: function() {
|
|
83
|
+
return custom_animate_1.ACustomAnimate;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
var number_1 = require("./custom/number");
|
|
88
|
+
|
|
89
|
+
Object.defineProperty(exports, "IncreaseCount", {
|
|
90
|
+
enumerable: !0,
|
|
91
|
+
get: function() {
|
|
92
|
+
return number_1.IncreaseCount;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
var input_text_1 = require("./custom/input-text");
|
|
97
|
+
|
|
98
|
+
Object.defineProperty(exports, "InputText", {
|
|
99
|
+
enumerable: !0,
|
|
100
|
+
get: function() {
|
|
101
|
+
return input_text_1.InputText;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
var clip_graphic_1 = require("./custom/clip-graphic");
|
|
106
|
+
|
|
107
|
+
Object.defineProperty(exports, "ClipGraphicAnimate", {
|
|
108
|
+
enumerable: !0,
|
|
109
|
+
get: function() {
|
|
110
|
+
return clip_graphic_1.ClipGraphicAnimate;
|
|
111
|
+
}
|
|
112
|
+
}), Object.defineProperty(exports, "ClipAngleAnimate", {
|
|
113
|
+
enumerable: !0,
|
|
114
|
+
get: function() {
|
|
115
|
+
return clip_graphic_1.ClipAngleAnimate;
|
|
116
|
+
}
|
|
117
|
+
}), Object.defineProperty(exports, "ClipRadiusAnimate", {
|
|
118
|
+
enumerable: !0,
|
|
119
|
+
get: function() {
|
|
120
|
+
return clip_graphic_1.ClipRadiusAnimate;
|
|
121
|
+
}
|
|
122
|
+
}), Object.defineProperty(exports, "ClipDirectionAnimate", {
|
|
123
|
+
enumerable: !0,
|
|
124
|
+
get: function() {
|
|
125
|
+
return clip_graphic_1.ClipDirectionAnimate;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
var tag_points_1 = require("./custom/tag-points");
|
|
130
|
+
|
|
131
|
+
Object.defineProperty(exports, "TagPointsUpdate", {
|
|
132
|
+
enumerable: !0,
|
|
133
|
+
get: function() {
|
|
134
|
+
return tag_points_1.TagPointsUpdate;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
var group_fade_1 = require("./custom/group-fade");
|
|
139
|
+
|
|
140
|
+
Object.defineProperty(exports, "GroupFadeIn", {
|
|
141
|
+
enumerable: !0,
|
|
142
|
+
get: function() {
|
|
143
|
+
return group_fade_1.GroupFadeIn;
|
|
144
|
+
}
|
|
145
|
+
}), Object.defineProperty(exports, "GroupFadeOut", {
|
|
146
|
+
enumerable: !0,
|
|
147
|
+
get: function() {
|
|
148
|
+
return group_fade_1.GroupFadeOut;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
var sphere_1 = require("./custom/sphere");
|
|
153
|
+
|
|
154
|
+
Object.defineProperty(exports, "RotateBySphereAnimate", {
|
|
155
|
+
enumerable: !0,
|
|
156
|
+
get: function() {
|
|
157
|
+
return sphere_1.RotateBySphereAnimate;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
var animate_executor_1 = require("./executor/animate-executor");
|
|
162
|
+
|
|
163
|
+
Object.defineProperty(exports, "AnimateExecutor", {
|
|
164
|
+
enumerable: !0,
|
|
165
|
+
get: function() {
|
|
166
|
+
return animate_executor_1.AnimateExecutor;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
var register_2 = require("./custom/register");
|
|
171
|
+
|
|
172
|
+
Object.defineProperty(exports, "registerCustomAnimate", {
|
|
173
|
+
enumerable: !0,
|
|
174
|
+
get: function() {
|
|
175
|
+
return register_2.registerCustomAnimate;
|
|
176
|
+
}
|
|
177
|
+
}), __exportStar(require("./state"), exports);
|
|
178
|
+
|
|
179
|
+
var animation_states_registry_1 = require("./state/animation-states-registry");
|
|
180
|
+
|
|
181
|
+
Object.defineProperty(exports, "AnimationTransitionRegistry", {
|
|
182
|
+
enumerable: !0,
|
|
183
|
+
get: function() {
|
|
184
|
+
return animation_states_registry_1.AnimationTransitionRegistry;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
var animation_states_registry_2 = require("./state/animation-states-registry");
|
|
189
|
+
|
|
190
|
+
Object.defineProperty(exports, "transitionRegistry", {
|
|
191
|
+
enumerable: !0,
|
|
192
|
+
get: function() {
|
|
193
|
+
return animation_states_registry_2.transitionRegistry;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
var animation_state_1 = require("./state/animation-state");
|
|
198
|
+
|
|
199
|
+
Object.defineProperty(exports, "AnimationStateManager", {
|
|
200
|
+
enumerable: !0,
|
|
201
|
+
get: function() {
|
|
202
|
+
return animation_state_1.AnimationStateManager;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
var animation_state_2 = require("./state/animation-state");
|
|
207
|
+
|
|
208
|
+
Object.defineProperty(exports, "AnimationStateStore", {
|
|
209
|
+
enumerable: !0,
|
|
210
|
+
get: function() {
|
|
211
|
+
return animation_state_2.AnimationStateStore;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AAGjC,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,wDAAsD;AAA7C,6GAAA,YAAY,OAAA;AACrB,0DAAwD;AAA/C,+GAAA,aAAa,OAAA;AACtB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAGb,sDAAoC;AACpC,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,0DAAyD;AAAhD,gHAAA,cAAc,OAAA;AACvB,0CAAgD;AAAvC,uGAAA,aAAa,OAAA;AACtB,kDAAgD;AAAvC,uGAAA,SAAS,OAAA;AAClB,sDAAsH;AAA7G,kHAAA,kBAAkB,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AACtF,kDAAsD;AAA7C,6GAAA,eAAe,OAAA;AACxB,kDAAgE;AAAvD,yGAAA,WAAW,OAAA;AAAE,0GAAA,YAAY,OAAA;AAClC,0CAAwD;AAA/C,+GAAA,qBAAqB,OAAA;AAC9B,gEAA8D;AAArD,mHAAA,eAAe,OAAA;AACxB,8CAA0D;AAAjD,iHAAA,qBAAqB,OAAA;AAE9B,0CAAwB;AACxB,+EAAgF;AAAvE,wIAAA,2BAA2B,OAAA;AACpC,+EAAuE;AAA9D,+HAAA,kBAAkB,OAAA;AAC3B,2DAAgE;AAAvD,wHAAA,qBAAqB,OAAA;AAC9B,2DAA8D;AAArD,sHAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["// 导出接口\nexport * from './intreface/animate';\nexport * from './intreface/timeline';\nexport * from './intreface/easing';\nexport * from './intreface/type';\n\n// 导出实现\nexport { Animate } from './animate';\nexport { DefaultTimeline } from './timeline';\nexport { ManualTicker } from './ticker/manual-ticker';\nexport { DefaultTicker } from './ticker/default-ticker';\nexport { Step } from './step';\n\n// 导出工具函数\nexport * from './utils/easing-func';\nexport { registerAnimate } from './register';\nexport { ACustomAnimate } from './custom/custom-animate';\nexport { IncreaseCount } from './custom/number';\nexport { InputText } from './custom/input-text';\nexport { ClipGraphicAnimate, ClipAngleAnimate, ClipRadiusAnimate, ClipDirectionAnimate } from './custom/clip-graphic';\nexport { TagPointsUpdate } from './custom/tag-points';\nexport { GroupFadeIn, GroupFadeOut } from './custom/group-fade';\nexport { RotateBySphereAnimate } from './custom/sphere';\nexport { AnimateExecutor } from './executor/animate-executor';\nexport { registerCustomAnimate } from './custom/register';\n// Export animation state modules\nexport * from './state';\nexport { AnimationTransitionRegistry } from './state/animation-states-registry';\nexport { transitionRegistry } from './state/animation-states-registry';\nexport { AnimationStateManager } from './state/animation-state';\nexport { AnimationStateStore } from './state/animation-state';\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
import type { EasingType } from '../intreface/easing';
|
|
3
|
+
import type { ACustomAnimate } from '../custom/custom-animate';
|
|
4
|
+
export type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;
|
|
5
|
+
export type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;
|
|
6
|
+
interface IAnimationParameters {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;
|
|
10
|
+
export type IAnimationChannelAttrs = Record<string, {
|
|
11
|
+
from?: any | IAnimationChannelFunction;
|
|
12
|
+
to?: any | IAnimationChannelFunction;
|
|
13
|
+
}>;
|
|
14
|
+
export type IAnimationChannelAttributes = string[];
|
|
15
|
+
export type IAnimationChannelInterpolator = (ratio: number, from: any, to: any, nextAttributes: any, datum: any, element: IGraphic, parameters: IAnimationParameters) => boolean | void;
|
|
16
|
+
export interface IAnimationCustomConstructor {
|
|
17
|
+
new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;
|
|
18
|
+
}
|
|
19
|
+
export interface IAnimationEffect {
|
|
20
|
+
type?: string;
|
|
21
|
+
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
22
|
+
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
23
|
+
customParameters?: MarkFunctionValueType<any>;
|
|
24
|
+
easing?: EasingType;
|
|
25
|
+
options?: MarkFunctionValueType<any>;
|
|
26
|
+
}
|
|
27
|
+
export interface IAnimationTimeSlice {
|
|
28
|
+
effects: IAnimationEffect | IAnimationEffect[];
|
|
29
|
+
duration?: MarkFunctionValueType<number>;
|
|
30
|
+
delay?: MarkFunctionValueType<number>;
|
|
31
|
+
delayAfter?: MarkFunctionValueType<number>;
|
|
32
|
+
}
|
|
33
|
+
export interface IAnimationControlOptions {
|
|
34
|
+
stopWhenStateChange?: boolean;
|
|
35
|
+
immediatelyApply?: boolean;
|
|
36
|
+
ignoreLoopFinalAttributes?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface IAnimationTypeConfig {
|
|
39
|
+
type?: string;
|
|
40
|
+
channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;
|
|
41
|
+
custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;
|
|
42
|
+
customParameters?: MarkFunctionValueType<any>;
|
|
43
|
+
easing?: EasingType;
|
|
44
|
+
delay?: MarkFunctionValueType<number>;
|
|
45
|
+
delayAfter?: MarkFunctionValueType<number>;
|
|
46
|
+
duration?: MarkFunctionValueType<number>;
|
|
47
|
+
oneByOne?: MarkFunctionValueType<boolean | number>;
|
|
48
|
+
startTime?: MarkFunctionValueType<number>;
|
|
49
|
+
totalTime?: MarkFunctionValueType<number>;
|
|
50
|
+
loop?: boolean | number;
|
|
51
|
+
options?: MarkFunctionValueType<any>;
|
|
52
|
+
controlOptions?: IAnimationControlOptions;
|
|
53
|
+
}
|
|
54
|
+
export interface IAnimationTimeline {
|
|
55
|
+
id?: string;
|
|
56
|
+
timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];
|
|
57
|
+
startTime?: MarkFunctionValueType<number>;
|
|
58
|
+
totalTime?: MarkFunctionValueType<number>;
|
|
59
|
+
oneByOne?: MarkFunctionValueType<number | boolean>;
|
|
60
|
+
loop?: MarkFunctionValueType<number | boolean>;
|
|
61
|
+
partitioner?: MarkFunctionCallback<boolean>;
|
|
62
|
+
sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;
|
|
63
|
+
controlOptions?: IAnimationControlOptions;
|
|
64
|
+
}
|
|
65
|
+
export type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interpolate/executor.ts"],"names":[],"mappings":"","file":"executor.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport type { EasingType } from '../intreface/easing';\nimport type { ACustomAnimate } from '../custom/custom-animate';\n\nexport type MarkFunctionCallback<T> = (datum: any, graphic: IGraphic, parameters: any) => T;\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\ninterface IAnimationParameters {\n [key: string]: any;\n}\n\n/**\n * 动画 channel 配置\n */\nexport type IAnimationChannelFunction = (datum: any, element: IGraphic, parameters: IAnimationParameters) => any;\n\n/**\n * 动画 channel 属性配置\n */\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\n\n/**\n * 动画 channel 插值器\n */\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IGraphic,\n parameters: IAnimationParameters\n) => boolean | void;\n\n/**\n * 动画 custom 构造器\n */\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationTimeSlice {\n /** 动画效果 */\n effects: IAnimationEffect | IAnimationEffect[];\n /** 动画时长 */\n duration?: MarkFunctionValueType<number>;\n /** 延迟delay后执行动画 */\n delay?: MarkFunctionValueType<number>;\n /** effect动画后再延迟delayAfter结束这个周期 */\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n /** encode 计算图元最终状态时是否忽略循环动画 */\n ignoreLoopFinalAttributes?: boolean;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n /** 动画类型 */\n type?: string;\n /** 动画 channel 配置 */\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n /** 动画 自定义插值 配置 */\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n /** 动画 custom 参数配置 */\n customParameters?: MarkFunctionValueType<any>;\n /** 动画 easing 配置 */\n easing?: EasingType;\n /** 动画 delay 配置 */\n delay?: MarkFunctionValueType<number>;\n /** 动画 delayAfter 配置 */\n delayAfter?: MarkFunctionValueType<number>;\n /** 动画 duration 配置 */\n duration?: MarkFunctionValueType<number>;\n /** 动画 oneByOne 配置(是否依次执行) */\n oneByOne?: MarkFunctionValueType<boolean | number>;\n /** 动画 startTime 配置 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画 totalTime 配置 */\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IGraphic, elementB: IGraphic, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画配置\n */\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function interpolateNumber(from: number, to: number, ratio: number): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function interpolateNumber(from, to, ratio) {
|
|
4
|
+
return from + (to - from) * ratio;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: !0
|
|
9
|
+
}), exports.interpolateNumber = void 0, exports.interpolateNumber = interpolateNumber;
|
|
10
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interpolate/number.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAAC,IAAY,EAAE,EAAU,EAAE,KAAa;IACvE,OAAO,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;AACpC,CAAC;AAFD,8CAEC","file":"number.js","sourcesContent":["export function interpolateNumber(from: number, to: number, ratio: number): number {\n return from + (to - from) * ratio;\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
import type { IStep } from '../intreface/animate';
|
|
3
|
+
export declare class InterpolateUpdateStore {
|
|
4
|
+
opacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
5
|
+
fillOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
6
|
+
strokeOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
7
|
+
zIndex: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
8
|
+
backgroundOpacity: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
9
|
+
shadowOffsetX: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
10
|
+
shadowOffsetY: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
11
|
+
shadowBlur: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
12
|
+
fill: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
|
|
13
|
+
fillPure: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
|
|
14
|
+
stroke: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
|
|
15
|
+
strokePure: (key: string, from: [number, number, number, number], to: [number, number, number, number], ratio: number, step: IStep, target: IGraphic) => void;
|
|
16
|
+
width: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
17
|
+
height: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
18
|
+
x: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
19
|
+
y: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
20
|
+
angle: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
21
|
+
scaleX: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
22
|
+
scaleY: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
23
|
+
lineWidth: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
24
|
+
startAngle: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
25
|
+
endAngle: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
26
|
+
radius: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
27
|
+
outerRadius: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
28
|
+
innerRadius: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
29
|
+
size: (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare const interpolateUpdateStore: InterpolateUpdateStore;
|
|
32
|
+
export declare function commonInterpolateUpdate(key: string, from: any, to: any, ratio: number, step: IStep, target: IGraphic): boolean;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.commonInterpolateUpdate = exports.interpolateUpdateStore = exports.InterpolateUpdateStore = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_core_1 = require("@visactor/vrender-core"), number_1 = require("./number");
|
|
8
|
+
|
|
9
|
+
class InterpolateUpdateStore {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.opacity = (key, from, to, ratio, step, target) => {
|
|
12
|
+
target.attribute.opacity = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
13
|
+
}, this.fillOpacity = (key, from, to, ratio, step, target) => {
|
|
14
|
+
target.attribute.fillOpacity = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
15
|
+
}, this.strokeOpacity = (key, from, to, ratio, step, target) => {
|
|
16
|
+
target.attribute.strokeOpacity = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
17
|
+
}, this.zIndex = (key, from, to, ratio, step, target) => {
|
|
18
|
+
target.attribute.zIndex = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
19
|
+
}, this.backgroundOpacity = (key, from, to, ratio, step, target) => {
|
|
20
|
+
target.attribute.backgroundOpacity = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
21
|
+
}, this.shadowOffsetX = (key, from, to, ratio, step, target) => {
|
|
22
|
+
target.attribute.shadowOffsetX = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
23
|
+
}, this.shadowOffsetY = (key, from, to, ratio, step, target) => {
|
|
24
|
+
target.attribute.shadowOffsetY = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
25
|
+
}, this.shadowBlur = (key, from, to, ratio, step, target) => {
|
|
26
|
+
target.attribute.shadowBlur = (0, number_1.interpolateNumber)(from, to, ratio);
|
|
27
|
+
}, this.fill = (key, from, to, ratio, step, target) => {
|
|
28
|
+
target.attribute.fill = (0, vrender_core_1.interpolateColor)(from, to, ratio, !1);
|
|
29
|
+
}, this.fillPure = (key, from, to, ratio, step, target) => {
|
|
30
|
+
target.attribute.fill = (0, vrender_core_1.interpolatePureColorArrayToStr)(step.fromParsedProps.fill, step.toParsedProps.fill, ratio);
|
|
31
|
+
}, this.stroke = (key, from, to, ratio, step, target) => {
|
|
32
|
+
target.attribute.stroke = (0, vrender_core_1.interpolateColor)(from, to, ratio, !1);
|
|
33
|
+
}, this.strokePure = (key, from, to, ratio, step, target) => {
|
|
34
|
+
target.attribute.stroke = (0, vrender_core_1.interpolatePureColorArrayToStr)(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio);
|
|
35
|
+
}, this.width = (key, from, to, ratio, step, target) => {
|
|
36
|
+
target.attribute.width = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
|
|
37
|
+
}, this.height = (key, from, to, ratio, step, target) => {
|
|
38
|
+
target.attribute.height = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
|
|
39
|
+
}, this.x = (key, from, to, ratio, step, target) => {
|
|
40
|
+
target.attribute.x = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
|
|
41
|
+
target.addUpdatePositionTag();
|
|
42
|
+
}, this.y = (key, from, to, ratio, step, target) => {
|
|
43
|
+
target.attribute.y = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
|
|
44
|
+
target.addUpdatePositionTag();
|
|
45
|
+
}, this.angle = (key, from, to, ratio, step, target) => {
|
|
46
|
+
target.attribute.angle = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
|
|
47
|
+
target.addUpdatePositionTag();
|
|
48
|
+
}, this.scaleX = (key, from, to, ratio, step, target) => {
|
|
49
|
+
target.attribute.scaleX = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
|
|
50
|
+
target.addUpdatePositionTag();
|
|
51
|
+
}, this.scaleY = (key, from, to, ratio, step, target) => {
|
|
52
|
+
target.attribute.scaleY = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag(),
|
|
53
|
+
target.addUpdatePositionTag();
|
|
54
|
+
}, this.lineWidth = (key, from, to, ratio, step, target) => {
|
|
55
|
+
target.attribute.lineWidth = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
|
|
56
|
+
}, this.startAngle = (key, from, to, ratio, step, target) => {
|
|
57
|
+
target.attribute.startAngle = (0, number_1.interpolateNumber)(from, to, ratio),
|
|
58
|
+
target.addUpdateBoundTag();
|
|
59
|
+
}, this.endAngle = (key, from, to, ratio, step, target) => {
|
|
60
|
+
target.attribute.endAngle = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
|
|
61
|
+
}, this.radius = (key, from, to, ratio, step, target) => {
|
|
62
|
+
target.attribute.radius = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
|
|
63
|
+
}, this.outerRadius = (key, from, to, ratio, step, target) => {
|
|
64
|
+
target.attribute.outerRadius = (0, number_1.interpolateNumber)(from, to, ratio),
|
|
65
|
+
target.addUpdateBoundTag();
|
|
66
|
+
}, this.innerRadius = (key, from, to, ratio, step, target) => {
|
|
67
|
+
target.attribute.innerRadius = (0, number_1.interpolateNumber)(from, to, ratio),
|
|
68
|
+
target.addUpdateBoundTag();
|
|
69
|
+
}, this.size = (key, from, to, ratio, step, target) => {
|
|
70
|
+
target.attribute.size = (0, number_1.interpolateNumber)(from, to, ratio), target.addUpdateBoundTag();
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
76
|
+
if (Number.isFinite(to) && Number.isFinite(from)) return target.attribute[key] = from + (to - from) * ratio,
|
|
77
|
+
!0;
|
|
78
|
+
if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {
|
|
79
|
+
const nextList = [];
|
|
80
|
+
let valid = !0;
|
|
81
|
+
for (let i = 0; i < to.length; i++) {
|
|
82
|
+
const v = from[i], val = v + (to[i] - v) * ratio;
|
|
83
|
+
if (!Number.isFinite(val)) {
|
|
84
|
+
valid = !1;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
nextList.push(val);
|
|
88
|
+
}
|
|
89
|
+
return valid && (target.attribute[key] = nextList), !0;
|
|
90
|
+
}
|
|
91
|
+
return !1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
exports.InterpolateUpdateStore = InterpolateUpdateStore, exports.interpolateUpdateStore = new InterpolateUpdateStore,
|
|
95
|
+
exports.commonInterpolateUpdate = commonInterpolateUpdate;
|
|
96
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/interpolate/store.ts"],"names":[],"mappings":";;;AACA,yDAA0F;AAC1F,qCAA6C;AAuD7C,MAAa,sBAAsB;IAAnC;QACE,YAAO,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YAChG,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,gBAAW,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IAAW,EAAE,MAAgB,EAAE,EAAE;YACpG,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpE,CAAC,CAAC;QACF,kBAAa,GAAG,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU,EAAE,KAAa,EAAE,IA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AC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAtBD,0DAsBC","file":"store.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender-core';\nimport { interpolateColor, interpolatePureColorArrayToStr } from '@visactor/vrender-core';\nimport { interpolateNumber } from './number';\nimport type { IStep } from '../intreface/animate';\n\n// 直接设置,触发 隐藏类(Hidden Class)优化:\n/**\n *\nconst a = { type: 1 };\nconst ITERATIONS = 1e7; // 测试次数\n\n// 动态生成 keys 数组(确保引擎无法静态推断 key)\nconst keys = [];\nfor (let i = 0; i < ITERATIONS; i++) {\n // 通过条件确保 key 动态变化(但实际始终为 'type',避免属性缺失的开销)\n keys.push(Math.random() < 0 ? 'other' : 'type');\n}\n\n// 测试字面量访问\nfunction testLiteral() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与动态测试完全一致)\n sum += a.type; // 差异仅在此处:使用字面量访问\n }\n return sum;\n}\n\n// 测试变量动态访问\nfunction testDynamic() {\n let sum = 0;\n for (let i = 0; i < ITERATIONS; i++) {\n const key = keys[i]; // 读取 key(与字面量测试完全一致)\n sum += a[key]; // 差异仅在此处:使用变量访问\n }\n return sum;\n}\n\n// 预热(避免 JIT 编译影响)\ntestLiteral();\ntestDynamic();\n\n// 正式测试\nconsole.time('literal');\ntestLiteral();\nconsole.timeEnd('literal');\n\nconsole.time('dynamic');\ntestDynamic();\nconsole.timeEnd('dynamic');\n\n\n// out:\n// literal: 7.1259765625 ms\n// dynamic: 9.322998046875 ms\n */\n\nexport class InterpolateUpdateStore {\n opacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.opacity = interpolateNumber(from, to, ratio);\n };\n fillOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.fillOpacity = interpolateNumber(from, to, ratio);\n };\n strokeOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.strokeOpacity = interpolateNumber(from, to, ratio);\n };\n zIndex = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.zIndex = interpolateNumber(from, to, ratio);\n };\n backgroundOpacity = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.backgroundOpacity = interpolateNumber(from, to, ratio);\n };\n shadowOffsetX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetX = interpolateNumber(from, to, ratio);\n };\n shadowOffsetY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowOffsetY = interpolateNumber(from, to, ratio);\n };\n shadowBlur = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.shadowBlur = interpolateNumber(from, to, ratio);\n };\n fill = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = interpolateColor(from, to, ratio, false) as any;\n };\n fillPure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.fill = interpolatePureColorArrayToStr(\n step.fromParsedProps.fill,\n step.toParsedProps.fill,\n ratio\n ) as any;\n };\n stroke = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = interpolateColor(from, to, ratio, false);\n };\n strokePure = (\n key: string,\n from: [number, number, number, number],\n to: [number, number, number, number],\n ratio: number,\n step: IStep,\n target: IGraphic\n ) => {\n target.attribute.stroke = interpolatePureColorArrayToStr(\n step.fromParsedProps.stroke,\n step.toParsedProps.stroke,\n ratio\n ) as any;\n };\n\n // 需要更新Bounds\n width = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).width = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n height = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).height = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n x = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.x = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n y = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.y = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n angle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.angle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleX = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleX = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n scaleY = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.scaleY = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n target.addUpdatePositionTag();\n };\n lineWidth = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n target.attribute.lineWidth = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n startAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).startAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n endAngle = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).endAngle = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n radius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).radius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n outerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).outerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n innerRadius = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).innerRadius = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n size = (key: string, from: number, to: number, ratio: number, step: IStep, target: IGraphic) => {\n (target.attribute as any).size = interpolateNumber(from, to, ratio);\n target.addUpdateBoundTag();\n };\n}\n\nexport const interpolateUpdateStore = new InterpolateUpdateStore();\n\nexport function commonInterpolateUpdate(key: string, from: any, to: any, ratio: number, step: IStep, target: IGraphic) {\n if (Number.isFinite(to) && Number.isFinite(from)) {\n (target.attribute as any)[key] = from + (to - from) * ratio;\n return true;\n } else if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {\n const nextList = [];\n let valid = true;\n for (let i = 0; i < to.length; i++) {\n const v = from[i];\n const val = v + (to[i] - v) * ratio;\n if (!Number.isFinite(val)) {\n valid = false;\n break;\n }\n nextList.push(val);\n }\n if (valid) {\n (target.attribute as any)[key] = nextList;\n }\n return true;\n }\n return false;\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
import type { EasingType, EasingTypeFunc } from './easing';
|
|
3
|
+
import type { AnimateStatus, IAnimateStepType } from './type';
|
|
4
|
+
import type { ITimeline } from './timeline';
|
|
5
|
+
export interface ICustomAnimate extends IStep {
|
|
6
|
+
type: IAnimateStepType;
|
|
7
|
+
}
|
|
8
|
+
export interface IStep {
|
|
9
|
+
type: IAnimateStepType;
|
|
10
|
+
prev?: IStep;
|
|
11
|
+
duration: number;
|
|
12
|
+
next?: IStep;
|
|
13
|
+
props?: Record<string, any>;
|
|
14
|
+
fromParsedProps?: Record<string, any>;
|
|
15
|
+
toParsedProps?: Record<string, any>;
|
|
16
|
+
fromProps?: Record<string, any>;
|
|
17
|
+
propKeys?: string[];
|
|
18
|
+
easing?: EasingTypeFunc;
|
|
19
|
+
append: (step: IStep) => void;
|
|
20
|
+
getLastProps: () => any;
|
|
21
|
+
animate: IAnimate;
|
|
22
|
+
setDuration: (duration: number, updateDownstream?: boolean) => void;
|
|
23
|
+
getDuration: () => number;
|
|
24
|
+
determineInterpolateUpdateFunction: () => void;
|
|
25
|
+
setStartTime: (time: number, updateDownstream?: boolean) => void;
|
|
26
|
+
getStartTime: () => number;
|
|
27
|
+
bind: (target: IGraphic, animate: IAnimate) => void;
|
|
28
|
+
onBind: () => void;
|
|
29
|
+
onFirstRun: () => void;
|
|
30
|
+
onStart: () => void;
|
|
31
|
+
onEnd: (cb?: (animate: IAnimate, step: IStep) => void) => void;
|
|
32
|
+
update: (end: boolean, ratio: number, out: Record<string, any>) => void;
|
|
33
|
+
onUpdate: (end: boolean, ratio: number, out: Record<string, any>) => void;
|
|
34
|
+
getEndProps: () => Record<string, any> | void;
|
|
35
|
+
getFromProps: () => Record<string, any> | void;
|
|
36
|
+
getMergedEndProps: () => Record<string, any> | void;
|
|
37
|
+
deleteSelfAttr: (key: string) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface IAnimate {
|
|
40
|
+
readonly id: string | number;
|
|
41
|
+
status: AnimateStatus;
|
|
42
|
+
target: IGraphic;
|
|
43
|
+
priority: number;
|
|
44
|
+
interpolateUpdateFunction: ((from: Record<string, any>, to: Record<string, any>, ratio: number, step: IStep, target: IGraphic) => void) | null;
|
|
45
|
+
_onStart?: (() => void)[];
|
|
46
|
+
_onFrame?: ((step: IStep, ratio: number) => void)[];
|
|
47
|
+
_onEnd?: (() => void)[];
|
|
48
|
+
_onRemove?: (() => void)[];
|
|
49
|
+
getStartProps: () => Record<string, any>;
|
|
50
|
+
getEndProps: () => Record<string, any>;
|
|
51
|
+
setTimeline: (timeline: ITimeline) => void;
|
|
52
|
+
getTimeline: () => ITimeline;
|
|
53
|
+
readonly timeline: ITimeline;
|
|
54
|
+
bind: (target: IGraphic) => this;
|
|
55
|
+
to: (props: Record<string, any>, duration: number, easing: EasingType) => this;
|
|
56
|
+
from: (props: Record<string, any>, duration: number, easing: EasingType) => this;
|
|
57
|
+
pause: () => void;
|
|
58
|
+
resume: () => void;
|
|
59
|
+
onStart: (cb?: () => void) => void;
|
|
60
|
+
onEnd: (cb?: () => void) => void;
|
|
61
|
+
onFrame: (cb: (step: IStep, ratio: number) => void) => void;
|
|
62
|
+
onRemove: (cb?: () => void) => void;
|
|
63
|
+
preventAttr: (key: string) => void;
|
|
64
|
+
preventAttrs: (key: string[]) => void;
|
|
65
|
+
validAttr: (key: string) => boolean;
|
|
66
|
+
runCb: (cb: (a: IAnimate, step: IStep) => void) => IAnimate;
|
|
67
|
+
customInterpolate: (key: string, ratio: number, from: any, to: any, target: IGraphic, ret: Record<string, any>) => boolean;
|
|
68
|
+
play: (customAnimate: ICustomAnimate) => this;
|
|
69
|
+
getFromValue: () => Record<string, any>;
|
|
70
|
+
getToValue: () => Record<string, any>;
|
|
71
|
+
stop: (type?: 'start' | 'end' | Record<string, any>) => void;
|
|
72
|
+
release: () => void;
|
|
73
|
+
getDuration: () => number;
|
|
74
|
+
getTotalDuration: () => number;
|
|
75
|
+
getStartTime: () => number;
|
|
76
|
+
wait: (delay: number) => this;
|
|
77
|
+
afterAll: (list: IAnimate[]) => this;
|
|
78
|
+
after: (animate: IAnimate) => this;
|
|
79
|
+
parallel: (animate: IAnimate) => this;
|
|
80
|
+
getLoop: () => number;
|
|
81
|
+
loop: (n: number | boolean) => IAnimate;
|
|
82
|
+
bounce: (b: boolean) => IAnimate;
|
|
83
|
+
advance: (delta: number) => void;
|
|
84
|
+
startAt: (t: number) => IAnimate;
|
|
85
|
+
reSyncProps: () => void;
|
|
86
|
+
updateDuration: () => void;
|
|
87
|
+
}
|
|
88
|
+
export declare enum AnimateMode {
|
|
89
|
+
NORMAL = 0,
|
|
90
|
+
SET_ATTR_IMMEDIATELY = 1
|
|
91
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var AnimateMode;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: !0
|
|
7
|
+
}), exports.AnimateMode = void 0, function(AnimateMode) {
|
|
8
|
+
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
9
|
+
}(AnimateMode = exports.AnimateMode || (exports.AnimateMode = {}));
|
|
10
|
+
//# sourceMappingURL=animate.js.map
|