@visactor/vrender-core 0.22.15-alpha.1 → 0.22.15
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/cjs/animate/Ticker/default-ticker.d.ts +40 -0
- package/cjs/animate/Ticker/default-ticker.js +140 -0
- package/cjs/animate/Ticker/default-ticker.js.map +1 -0
- package/cjs/animate/Ticker/index.d.ts +5 -0
- package/cjs/{interface/animation → animate/Ticker}/index.js +3 -3
- package/cjs/animate/Ticker/index.js.map +1 -0
- package/cjs/animate/Ticker/manual-ticker-handler.d.ts +15 -0
- package/cjs/animate/Ticker/manual-ticker-handler.js +36 -0
- package/cjs/animate/Ticker/manual-ticker-handler.js.map +1 -0
- package/cjs/animate/Ticker/manual-ticker.d.ts +19 -0
- package/cjs/animate/Ticker/manual-ticker.js +37 -0
- package/cjs/animate/Ticker/manual-ticker.js.map +1 -0
- package/cjs/animate/Ticker/raf-tick-handler.d.ts +9 -0
- package/cjs/animate/Ticker/raf-tick-handler.js +30 -0
- package/cjs/animate/Ticker/raf-tick-handler.js.map +1 -0
- package/cjs/animate/Ticker/timeout-tick-handler.d.ts +9 -0
- package/cjs/animate/Ticker/timeout-tick-handler.js +28 -0
- package/cjs/animate/Ticker/timeout-tick-handler.js.map +1 -0
- package/cjs/animate/Ticker/type.d.ts +6 -0
- package/cjs/{interface/animation/ticker.js → animate/Ticker/type.js} +1 -1
- package/cjs/animate/Ticker/type.js.map +1 -0
- package/cjs/animate/animate.d.ts +147 -0
- package/cjs/animate/animate.js +403 -0
- package/cjs/animate/animate.js.map +1 -0
- package/cjs/animate/config.d.ts +2 -1
- package/cjs/animate/config.js +5 -1
- package/cjs/animate/config.js.map +1 -1
- package/cjs/animate/custom-animate.d.ts +236 -0
- package/cjs/animate/custom-animate.js +726 -0
- package/cjs/animate/custom-animate.js.map +1 -0
- package/cjs/animate/default-ticker.d.ts +2 -0
- package/cjs/animate/default-ticker.js +14 -0
- package/cjs/animate/default-ticker.js.map +1 -0
- package/cjs/animate/easing-func.d.ts +1 -0
- package/cjs/animate/easing-func.js +16 -0
- package/cjs/animate/easing-func.js.map +1 -0
- package/cjs/animate/easing.d.ts +49 -0
- package/cjs/animate/easing.js +141 -0
- package/cjs/animate/easing.js.map +1 -0
- package/cjs/animate/group-fade.d.ts +16 -0
- package/cjs/animate/group-fade.js +66 -0
- package/cjs/animate/group-fade.js.map +1 -0
- package/cjs/animate/index.d.ts +8 -0
- package/cjs/animate/index.js +24 -0
- package/cjs/animate/index.js.map +1 -0
- package/cjs/animate/morphing.d.ts +52 -0
- package/cjs/animate/morphing.js +292 -0
- package/cjs/animate/morphing.js.map +1 -0
- package/cjs/animate/timeline.d.ts +17 -0
- package/cjs/animate/timeline.js +46 -0
- package/cjs/animate/timeline.js.map +1 -0
- package/cjs/application.d.ts +1 -2
- package/cjs/application.js.map +1 -1
- package/cjs/canvas/constants.js +2 -1
- package/cjs/canvas/empty-context.d.ts +0 -1
- package/cjs/canvas/empty-context.js +0 -4
- package/cjs/canvas/empty-context.js.map +1 -1
- package/cjs/color-string/interpolate.d.ts +0 -1
- package/cjs/color-string/interpolate.js +4 -12
- package/cjs/color-string/interpolate.js.map +1 -1
- package/cjs/color-string/store.js +1 -2
- package/cjs/common/custom-path2d.js +2 -2
- package/cjs/common/custom-path2d.js.map +1 -1
- package/cjs/common/enums.d.ts +16 -0
- package/cjs/common/enums.js +11 -2
- package/cjs/common/enums.js.map +1 -1
- package/cjs/common/morphing-utils.js +124 -32
- package/cjs/common/morphing-utils.js.map +1 -1
- package/cjs/common/polygon.js +2 -5
- package/cjs/common/polygon.js.map +1 -1
- package/cjs/common/segment/curve/cubic-bezier.d.ts +2 -1
- package/cjs/common/segment/curve/cubic-bezier.js +8 -3
- package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
- package/cjs/common/segment/curve/quadratic-bezier.d.ts +0 -1
- package/cjs/common/segment/curve/quadratic-bezier.js +3 -10
- package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
- package/cjs/common/segment/index.d.ts +0 -1
- package/cjs/common/segment/index.js +1 -1
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/common/shape/arc.d.ts +1 -1
- package/cjs/common/shape/arc.js +3 -7
- package/cjs/common/shape/arc.js.map +1 -1
- package/cjs/common/simplify.js +2 -1
- package/cjs/common/sort.js +1 -1
- package/cjs/common/split-path.js +2 -2
- package/cjs/common/split-path.js.map +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js +1 -1
- package/cjs/common/utils.d.ts +2 -0
- package/cjs/common/utils.js +9 -5
- package/cjs/common/utils.js.map +1 -1
- package/cjs/core/application.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/global.d.ts +0 -3
- package/cjs/core/global.js +3 -14
- package/cjs/core/global.js.map +1 -1
- package/cjs/core/stage.d.ts +3 -8
- package/cjs/core/stage.js +20 -34
- package/cjs/core/stage.js.map +1 -1
- package/cjs/graphic/arc.d.ts +2 -1
- package/cjs/graphic/arc.js +2 -3
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/area.d.ts +2 -1
- package/cjs/graphic/area.js +1 -4
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/circle.d.ts +2 -1
- package/cjs/graphic/circle.js +2 -5
- package/cjs/graphic/circle.js.map +1 -1
- package/cjs/graphic/config.js +1 -2
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-module.js +2 -1
- package/cjs/graphic/graphic-service/graphic-module.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.js +3 -2
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +12 -9
- package/cjs/graphic/graphic.js +105 -48
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/group.js +8 -8
- package/cjs/graphic/group.js.map +1 -1
- package/cjs/graphic/line.d.ts +2 -1
- package/cjs/graphic/line.js +1 -5
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/graphic/rect.js +2 -5
- package/cjs/graphic/rect.js.map +1 -1
- package/cjs/graphic/richtext/icon.d.ts +1 -1
- package/cjs/graphic/richtext/icon.js.map +1 -1
- package/cjs/graphic/richtext/paragraph.js +2 -2
- package/cjs/graphic/richtext/paragraph.js.map +1 -1
- package/cjs/graphic/star.d.ts +2 -1
- package/cjs/graphic/star.js +2 -4
- package/cjs/graphic/star.js.map +1 -1
- package/cjs/index.d.ts +3 -2
- package/cjs/index.js +16 -14
- package/cjs/index.js.map +1 -1
- package/cjs/interface/animate.d.ts +160 -1
- package/cjs/interface/animate.js +4 -1
- package/cjs/interface/animate.js.map +1 -1
- package/cjs/interface/context.d.ts +0 -1
- package/cjs/interface/context.js.map +1 -1
- package/cjs/interface/global.d.ts +0 -2
- package/cjs/interface/global.js.map +1 -1
- package/cjs/interface/graphic.d.ts +3 -11
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/index.d.ts +1 -1
- package/cjs/interface/index.js +9 -9
- package/cjs/interface/index.js.map +1 -1
- package/cjs/interface/render.d.ts +0 -7
- package/cjs/interface/render.js.map +1 -1
- package/cjs/interface/stage.d.ts +1 -4
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/modules.d.ts +1 -2
- package/cjs/modules.js +3 -4
- package/cjs/modules.js.map +1 -1
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js +8 -9
- package/cjs/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +11 -14
- package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/edit-module.js +4 -4
- package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +10 -13
- package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +1 -0
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js +5 -8
- package/cjs/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +5 -6
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.d.ts +2 -4
- package/cjs/render/contributions/render/arc-render.js +17 -19
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +2 -2
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-render.d.ts +2 -2
- package/cjs/render/contributions/render/base-render.js +2 -2
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.d.ts +0 -1
- package/cjs/render/contributions/render/draw-contribution.js +19 -23
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.js +1 -2
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/group-render.d.ts +2 -2
- package/cjs/render/contributions/render/group-render.js +11 -15
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +1 -1
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.d.ts +1 -3
- package/cjs/render/contributions/render/rect-render.js +15 -17
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.d.ts +2 -4
- package/cjs/render/contributions/render/symbol-render.js +11 -16
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/render-service.d.ts +1 -1
- package/cjs/render/render-service.js.map +1 -1
- package/dist/index.es.js +8868 -6022
- package/es/animate/Ticker/default-ticker.d.ts +40 -0
- package/es/animate/Ticker/default-ticker.js +138 -0
- package/es/animate/Ticker/default-ticker.js.map +1 -0
- package/es/animate/Ticker/index.d.ts +5 -0
- package/es/animate/Ticker/index.js +10 -0
- package/es/animate/Ticker/index.js.map +1 -0
- package/es/animate/Ticker/manual-ticker-handler.d.ts +15 -0
- package/es/animate/Ticker/manual-ticker-handler.js +28 -0
- package/es/animate/Ticker/manual-ticker-handler.js.map +1 -0
- package/es/animate/Ticker/manual-ticker.d.ts +19 -0
- package/es/animate/Ticker/manual-ticker.js +31 -0
- package/es/animate/Ticker/manual-ticker.js.map +1 -0
- package/es/animate/Ticker/raf-tick-handler.d.ts +9 -0
- package/es/animate/Ticker/raf-tick-handler.js +22 -0
- package/es/animate/Ticker/raf-tick-handler.js.map +1 -0
- package/es/animate/Ticker/timeout-tick-handler.d.ts +9 -0
- package/es/animate/Ticker/timeout-tick-handler.js +20 -0
- package/es/animate/Ticker/timeout-tick-handler.js.map +1 -0
- package/es/animate/Ticker/type.d.ts +6 -0
- package/es/{interface/animation/ticker.js → animate/Ticker/type.js} +1 -1
- package/es/animate/Ticker/type.js.map +1 -0
- package/es/animate/animate.d.ts +147 -0
- package/es/animate/animate.js +398 -0
- package/es/animate/animate.js.map +1 -0
- package/es/animate/config.d.ts +2 -1
- package/es/animate/config.js +5 -0
- package/es/animate/config.js.map +1 -1
- package/es/animate/custom-animate.d.ts +236 -0
- package/es/animate/custom-animate.js +703 -0
- package/es/animate/custom-animate.js.map +1 -0
- package/es/animate/default-ticker.d.ts +2 -0
- package/es/animate/default-ticker.js +12 -0
- package/es/animate/default-ticker.js.map +1 -0
- package/es/animate/easing-func.d.ts +1 -0
- package/es/animate/easing-func.js +10 -0
- package/es/animate/easing-func.js.map +1 -0
- package/es/animate/easing.d.ts +49 -0
- package/es/animate/easing.js +134 -0
- package/es/animate/easing.js.map +1 -0
- package/es/animate/group-fade.d.ts +16 -0
- package/es/animate/group-fade.js +56 -0
- package/es/animate/group-fade.js.map +1 -0
- package/es/animate/index.d.ts +8 -0
- package/es/animate/index.js +16 -0
- package/es/animate/index.js.map +1 -0
- package/es/animate/morphing.d.ts +52 -0
- package/es/animate/morphing.js +295 -0
- package/es/animate/morphing.js.map +1 -0
- package/es/animate/timeline.d.ts +17 -0
- package/es/animate/timeline.js +42 -0
- package/es/animate/timeline.js.map +1 -0
- package/es/application.d.ts +1 -2
- package/es/application.js.map +1 -1
- package/es/canvas/constants.js +2 -1
- package/es/canvas/empty-context.d.ts +0 -1
- package/es/canvas/empty-context.js +0 -4
- package/es/canvas/empty-context.js.map +1 -1
- package/es/color-string/interpolate.d.ts +0 -1
- package/es/color-string/interpolate.js +1 -8
- package/es/color-string/interpolate.js.map +1 -1
- package/es/color-string/store.js +1 -2
- package/es/common/custom-path2d.js +2 -2
- package/es/common/custom-path2d.js.map +1 -1
- package/es/common/enums.d.ts +16 -0
- package/es/common/enums.js +20 -0
- package/es/common/enums.js.map +1 -1
- package/es/common/morphing-utils.js +124 -29
- package/es/common/morphing-utils.js.map +1 -1
- package/es/common/polygon.js +3 -6
- package/es/common/polygon.js.map +1 -1
- package/es/common/segment/curve/cubic-bezier.d.ts +2 -1
- package/es/common/segment/curve/cubic-bezier.js +8 -1
- package/es/common/segment/curve/cubic-bezier.js.map +1 -1
- package/es/common/segment/curve/quadratic-bezier.d.ts +0 -1
- package/es/common/segment/curve/quadratic-bezier.js +2 -5
- package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
- package/es/common/segment/index.d.ts +0 -1
- package/es/common/segment/index.js +0 -2
- package/es/common/segment/index.js.map +1 -1
- package/es/common/shape/arc.d.ts +1 -1
- package/es/common/shape/arc.js +3 -7
- package/es/common/shape/arc.js.map +1 -1
- package/es/common/simplify.js +2 -1
- package/es/common/sort.js +1 -1
- package/es/common/split-path.js +2 -2
- package/es/common/split-path.js.map +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js +1 -1
- package/es/common/utils.d.ts +2 -0
- package/es/common/utils.js +5 -1
- package/es/common/utils.js.map +1 -1
- package/es/core/application.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/global.d.ts +0 -3
- package/es/core/global.js +2 -15
- package/es/core/global.js.map +1 -1
- package/es/core/stage.d.ts +3 -8
- package/es/core/stage.js +22 -35
- package/es/core/stage.js.map +1 -1
- package/es/graphic/arc.d.ts +2 -1
- package/es/graphic/arc.js +2 -3
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/area.d.ts +2 -1
- package/es/graphic/area.js +1 -4
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/circle.d.ts +2 -1
- package/es/graphic/circle.js +2 -4
- package/es/graphic/circle.js.map +1 -1
- package/es/graphic/config.js +1 -2
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic-service/graphic-module.js +1 -1
- package/es/graphic/graphic-service/graphic-module.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.js +4 -1
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.d.ts +12 -9
- package/es/graphic/graphic.js +109 -52
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/group.js +7 -7
- package/es/graphic/group.js.map +1 -1
- package/es/graphic/line.d.ts +2 -1
- package/es/graphic/line.js +1 -5
- package/es/graphic/line.js.map +1 -1
- package/es/graphic/rect.js +2 -5
- package/es/graphic/rect.js.map +1 -1
- package/es/graphic/richtext/icon.d.ts +1 -1
- package/es/graphic/richtext/icon.js.map +1 -1
- package/es/graphic/richtext/paragraph.js +2 -2
- package/es/graphic/richtext/paragraph.js.map +1 -1
- package/es/graphic/star.d.ts +2 -1
- package/es/graphic/star.js +2 -4
- package/es/graphic/star.js.map +1 -1
- package/es/index.d.ts +3 -2
- package/es/index.js +6 -4
- package/es/index.js.map +1 -1
- package/es/interface/animate.d.ts +160 -1
- package/es/interface/animate.js +1 -2
- package/es/interface/animate.js.map +1 -1
- package/es/interface/context.d.ts +0 -1
- package/es/interface/context.js.map +1 -1
- package/es/interface/global.d.ts +0 -2
- package/es/interface/global.js.map +1 -1
- package/es/interface/graphic.d.ts +3 -11
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/index.d.ts +1 -1
- package/es/interface/index.js +2 -2
- package/es/interface/index.js.map +1 -1
- package/es/interface/render.d.ts +0 -7
- package/es/interface/render.js.map +1 -1
- package/es/interface/stage.d.ts +1 -4
- package/es/interface/stage.js.map +1 -1
- package/es/modules.d.ts +1 -2
- package/es/modules.js +0 -6
- package/es/modules.js.map +1 -1
- package/es/plugins/builtin-plugin/auto-render-plugin.js +8 -8
- package/es/plugins/builtin-plugin/auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +12 -13
- package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/edit-module.js +4 -4
- package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
- package/es/plugins/builtin-plugin/flex-layout-plugin.js +11 -12
- package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +1 -0
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js +5 -8
- package/es/plugins/builtin-plugin/incremental-auto-render-plugin.js.map +1 -1
- package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +1 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +3 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +1 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +2 -2
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +5 -4
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
- package/es/render/contributions/render/arc-render.d.ts +2 -4
- package/es/render/contributions/render/arc-render.js +17 -19
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +2 -2
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-render.d.ts +2 -2
- package/es/render/contributions/render/base-render.js +2 -2
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.d.ts +0 -1
- package/es/render/contributions/render/draw-contribution.js +19 -23
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.js +1 -2
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/group-render.d.ts +2 -2
- package/es/render/contributions/render/group-render.js +11 -15
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +1 -1
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.d.ts +1 -3
- package/es/render/contributions/render/rect-render.js +14 -17
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.d.ts +2 -4
- package/es/render/contributions/render/symbol-render.js +11 -16
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/render-service.d.ts +1 -1
- package/es/render/render-service.js.map +1 -1
- package/package.json +4 -4
- package/cjs/common/diff.d.ts +0 -1
- package/cjs/common/diff.js +0 -19
- package/cjs/common/diff.js.map +0 -1
- package/cjs/common/performance-raf.d.ts +0 -8
- package/cjs/common/performance-raf.js +0 -32
- package/cjs/common/performance-raf.js.map +0 -1
- package/cjs/interface/animation/animate.d.ts +0 -117
- package/cjs/interface/animation/animate.js +0 -10
- package/cjs/interface/animation/animate.js.map +0 -1
- package/cjs/interface/animation/easing.d.ts +0 -3
- package/cjs/interface/animation/easing.js +0 -6
- package/cjs/interface/animation/easing.js.map +0 -1
- package/cjs/interface/animation/index.d.ts +0 -5
- package/cjs/interface/animation/index.js.map +0 -1
- package/cjs/interface/animation/ticker.d.ts +0 -39
- package/cjs/interface/animation/ticker.js.map +0 -1
- package/cjs/interface/animation/timeline.d.ts +0 -17
- package/cjs/interface/animation/timeline.js +0 -6
- package/cjs/interface/animation/timeline.js.map +0 -1
- package/cjs/interface/animation/type.d.ts +0 -13
- package/cjs/interface/animation/type.js +0 -15
- package/cjs/interface/animation/type.js.map +0 -1
- package/es/common/diff.d.ts +0 -1
- package/es/common/diff.js +0 -11
- package/es/common/diff.js.map +0 -1
- package/es/common/performance-raf.d.ts +0 -8
- package/es/common/performance-raf.js +0 -24
- package/es/common/performance-raf.js.map +0 -1
- package/es/interface/animation/animate.d.ts +0 -117
- package/es/interface/animation/animate.js +0 -6
- package/es/interface/animation/animate.js.map +0 -1
- package/es/interface/animation/easing.d.ts +0 -3
- package/es/interface/animation/easing.js +0 -2
- package/es/interface/animation/easing.js.map +0 -1
- package/es/interface/animation/index.d.ts +0 -5
- package/es/interface/animation/index.js +0 -10
- package/es/interface/animation/index.js.map +0 -1
- package/es/interface/animation/ticker.d.ts +0 -39
- package/es/interface/animation/ticker.js.map +0 -1
- package/es/interface/animation/timeline.d.ts +0 -17
- package/es/interface/animation/timeline.js +0 -2
- package/es/interface/animation/timeline.js.map +0 -1
- package/es/interface/animation/type.d.ts +0 -13
- package/es/interface/animation/type.js +0 -14
- package/es/interface/animation/type.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EventEmitter } from '@visactor/vutils';
|
|
2
|
+
import type { ITickHandler, ITimeline, ITicker } from '../../interface';
|
|
3
|
+
import type { TickerMode } from './type';
|
|
4
|
+
import { STATUS } from './type';
|
|
5
|
+
export declare class DefaultTicker extends EventEmitter implements ITicker {
|
|
6
|
+
protected interval: number;
|
|
7
|
+
protected tickerHandler: ITickHandler;
|
|
8
|
+
protected _mode: TickerMode;
|
|
9
|
+
protected status: STATUS;
|
|
10
|
+
protected lastFrameTime: number;
|
|
11
|
+
protected tickCounts: number;
|
|
12
|
+
protected timelines: ITimeline[];
|
|
13
|
+
autoStop: boolean;
|
|
14
|
+
set mode(m: TickerMode);
|
|
15
|
+
get mode(): TickerMode;
|
|
16
|
+
constructor(timelines?: ITimeline[]);
|
|
17
|
+
init(): void;
|
|
18
|
+
addTimeline(timeline: ITimeline): void;
|
|
19
|
+
remTimeline(timeline: ITimeline): void;
|
|
20
|
+
getTimelines(): ITimeline[];
|
|
21
|
+
protected initHandler(): ITickHandler | null;
|
|
22
|
+
protected setupTickHandler(): boolean;
|
|
23
|
+
setInterval(interval: number): void;
|
|
24
|
+
getInterval(): number;
|
|
25
|
+
setFPS(fps: number): void;
|
|
26
|
+
getFPS(): number;
|
|
27
|
+
tick(interval: number): void;
|
|
28
|
+
tickTo(t: number): void;
|
|
29
|
+
pause(): boolean;
|
|
30
|
+
resume(): boolean;
|
|
31
|
+
ifCanStop(): boolean;
|
|
32
|
+
start(force?: boolean): boolean;
|
|
33
|
+
stop(): void;
|
|
34
|
+
protected handleTick: (handler: ITickHandler, params?: {
|
|
35
|
+
once?: boolean;
|
|
36
|
+
}) => void;
|
|
37
|
+
protected _handlerTick: () => void;
|
|
38
|
+
release(): void;
|
|
39
|
+
trySyncTickStatus(): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { EventEmitter, Logger } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { application } from "../../application";
|
|
4
|
+
|
|
5
|
+
import { STATUS } from "./type";
|
|
6
|
+
|
|
7
|
+
import { RAFTickHandler } from "./raf-tick-handler";
|
|
8
|
+
|
|
9
|
+
import { TimeOutTickHandler } from "./timeout-tick-handler";
|
|
10
|
+
|
|
11
|
+
export class DefaultTicker extends EventEmitter {
|
|
12
|
+
set mode(m) {
|
|
13
|
+
this._mode !== m && (this._mode = m, this.setupTickHandler());
|
|
14
|
+
}
|
|
15
|
+
get mode() {
|
|
16
|
+
return this._mode;
|
|
17
|
+
}
|
|
18
|
+
constructor(timelines = []) {
|
|
19
|
+
super(), this.handleTick = (handler, params) => {
|
|
20
|
+
const {once: once = !1} = null != params ? params : {};
|
|
21
|
+
this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
|
|
22
|
+
}, this._handlerTick = () => {
|
|
23
|
+
const time = this.tickerHandler.getTime();
|
|
24
|
+
let delta = 0;
|
|
25
|
+
this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time,
|
|
26
|
+
this.status === STATUS.RUNNING && (this.tickCounts++, this.timelines.forEach((t => {
|
|
27
|
+
t.tick(delta);
|
|
28
|
+
})), this.emit("tick"));
|
|
29
|
+
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines,
|
|
30
|
+
this.autoStop = !0;
|
|
31
|
+
}
|
|
32
|
+
init() {
|
|
33
|
+
this.interval = NaN, this.status = STATUS.INITIAL, application.global.hooks.onSetEnv.tap("default-ticker", (() => {
|
|
34
|
+
this.initHandler();
|
|
35
|
+
})), application.global.env && this.initHandler();
|
|
36
|
+
}
|
|
37
|
+
addTimeline(timeline) {
|
|
38
|
+
this.timelines.push(timeline);
|
|
39
|
+
}
|
|
40
|
+
remTimeline(timeline) {
|
|
41
|
+
this.timelines = this.timelines.filter((t => t !== timeline));
|
|
42
|
+
}
|
|
43
|
+
getTimelines() {
|
|
44
|
+
return this.timelines;
|
|
45
|
+
}
|
|
46
|
+
initHandler() {
|
|
47
|
+
if (this._mode) return null;
|
|
48
|
+
const ticks = [ {
|
|
49
|
+
mode: "raf",
|
|
50
|
+
cons: RAFTickHandler
|
|
51
|
+
}, {
|
|
52
|
+
mode: "timeout",
|
|
53
|
+
cons: TimeOutTickHandler
|
|
54
|
+
} ];
|
|
55
|
+
for (let i = 0; i < ticks.length; i++) if (ticks[i].cons.Avaliable()) {
|
|
56
|
+
this.mode = ticks[i].mode;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
setupTickHandler() {
|
|
62
|
+
let handler;
|
|
63
|
+
switch (this._mode) {
|
|
64
|
+
case "raf":
|
|
65
|
+
handler = new RAFTickHandler;
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
case "timeout":
|
|
69
|
+
handler = new TimeOutTickHandler;
|
|
70
|
+
break;
|
|
71
|
+
|
|
72
|
+
default:
|
|
73
|
+
Logger.getInstance().warn("非法的计时器模式"), handler = new RAFTickHandler;
|
|
74
|
+
}
|
|
75
|
+
return !!handler.avaliable() && (this.tickerHandler && this.tickerHandler.release(),
|
|
76
|
+
this.tickerHandler = handler, !0);
|
|
77
|
+
}
|
|
78
|
+
setInterval(interval) {
|
|
79
|
+
this.interval = interval;
|
|
80
|
+
}
|
|
81
|
+
getInterval() {
|
|
82
|
+
return this.interval;
|
|
83
|
+
}
|
|
84
|
+
setFPS(fps) {
|
|
85
|
+
this.setInterval(1e3 / fps);
|
|
86
|
+
}
|
|
87
|
+
getFPS() {
|
|
88
|
+
return 1e3 / this.interval;
|
|
89
|
+
}
|
|
90
|
+
tick(interval) {
|
|
91
|
+
this.tickerHandler.tick(interval, (handler => {
|
|
92
|
+
this.handleTick(handler, {
|
|
93
|
+
once: !0
|
|
94
|
+
});
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
tickTo(t) {
|
|
98
|
+
this.tickerHandler.tickTo && this.tickerHandler.tickTo(t, (handler => {
|
|
99
|
+
this.handleTick(handler, {
|
|
100
|
+
once: !0
|
|
101
|
+
});
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
pause() {
|
|
105
|
+
return this.status !== STATUS.INITIAL && (this.status = STATUS.PAUSE, !0);
|
|
106
|
+
}
|
|
107
|
+
resume() {
|
|
108
|
+
return this.status !== STATUS.INITIAL && (this.status = STATUS.RUNNING, !0);
|
|
109
|
+
}
|
|
110
|
+
ifCanStop() {
|
|
111
|
+
if (this.autoStop) {
|
|
112
|
+
if (!this.timelines.length) return !0;
|
|
113
|
+
if (0 === this.timelines.reduce(((a, b) => a + b.animateCount), 0)) return !0;
|
|
114
|
+
}
|
|
115
|
+
return !1;
|
|
116
|
+
}
|
|
117
|
+
start(force = !1) {
|
|
118
|
+
if (this.status === STATUS.RUNNING) return !1;
|
|
119
|
+
if (!this.tickerHandler) return !1;
|
|
120
|
+
if (!force) {
|
|
121
|
+
if (this.status === STATUS.PAUSE) return !1;
|
|
122
|
+
if (!this.timelines.length) return !1;
|
|
123
|
+
if (0 === this.timelines.reduce(((a, b) => a + b.animateCount), 0)) return !1;
|
|
124
|
+
}
|
|
125
|
+
return this.status = STATUS.RUNNING, this.tickerHandler.tick(0, this.handleTick),
|
|
126
|
+
!0;
|
|
127
|
+
}
|
|
128
|
+
stop() {
|
|
129
|
+
this.status = STATUS.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
|
|
130
|
+
}
|
|
131
|
+
release() {
|
|
132
|
+
this.stop(), this.timelines = [], this.tickerHandler.release(), this.emit("afterTick");
|
|
133
|
+
}
|
|
134
|
+
trySyncTickStatus() {
|
|
135
|
+
this.status === STATUS.RUNNING && this._handlerTick();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=default-ticker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/default-ticker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,OAAO,aAAc,SAAQ,YAAY;IAU7C,IAAI,IAAI,CAAC,CAAa;QACpB,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CA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AAK,CAAC;SACd;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,KAAK,EAAE;YAEV,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,EAAE;gBAChC,OAAO,KAAK,CAAC;aACd;YACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;gBAC1B,OAAO,KAAK,CAAC;aACd;YACD,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE;gBAChE,OAAO,KAAK,CAAC;aACd;SACF;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI;QAEF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAC1B,CAAC;IAqCD,OAAO;QACL,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAMD,iBAAiB;QACf,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,EAAE;YAClC,IAAI,CAAC,YAAY,EAAE,CAAC;SACrB;IACH,CAAC;CACF","file":"default-ticker.js","sourcesContent":["import { EventEmitter, Logger } from '@visactor/vutils';\nimport type { ITickHandler, ITickerHandlerStatic, ITimeline, ITicker } from '../../interface';\nimport { application } from '../../application';\nimport type { TickerMode } from './type';\nimport { STATUS } from './type';\nimport { RAFTickHandler } from './raf-tick-handler';\nimport { TimeOutTickHandler } from './timeout-tick-handler';\n\nexport class DefaultTicker extends EventEmitter implements ITicker {\n protected interval: number;\n protected tickerHandler: ITickHandler;\n protected _mode: TickerMode;\n protected status: STATUS;\n protected lastFrameTime: number;\n protected tickCounts: number;\n protected timelines: ITimeline[];\n autoStop: boolean;\n\n set mode(m: TickerMode) {\n if (this._mode === m) {\n return;\n }\n this._mode = m;\n this.setupTickHandler();\n }\n get mode(): TickerMode {\n return this._mode;\n }\n\n constructor(timelines: ITimeline[] = []) {\n super();\n this.init();\n this.lastFrameTime = -1;\n this.tickCounts = 0;\n this.timelines = timelines;\n this.autoStop = true;\n }\n\n init() {\n this.interval = NaN;\n this.status = STATUS.INITIAL;\n application.global.hooks.onSetEnv.tap('default-ticker', () => {\n this.initHandler();\n });\n if (application.global.env) {\n this.initHandler();\n }\n }\n\n addTimeline(timeline: ITimeline) {\n this.timelines.push(timeline);\n }\n remTimeline(timeline: ITimeline) {\n this.timelines = this.timelines.filter(t => t !== timeline);\n }\n getTimelines(): ITimeline[] {\n return this.timelines;\n }\n\n protected initHandler(): ITickHandler | null {\n if (this._mode) {\n return null;\n }\n const ticks: { mode: TickerMode; cons: ITickerHandlerStatic }[] = [\n { mode: 'raf', cons: RAFTickHandler },\n { mode: 'timeout', cons: TimeOutTickHandler }\n ];\n for (let i = 0; i < ticks.length; i++) {\n if (ticks[i].cons.Avaliable()) {\n this.mode = ticks[i].mode;\n break;\n }\n }\n return null;\n }\n\n /**\n * 设置tickHandler\n * @returns 返回true表示设置成功,false表示设置失败\n */\n protected setupTickHandler(): boolean {\n let handler: ITickHandler;\n // 创建下一个tickHandler\n switch (this._mode) {\n case 'raf':\n handler = new RAFTickHandler();\n break;\n case 'timeout':\n handler = new TimeOutTickHandler();\n break;\n // case 'manual':\n // handler = new ManualTickHandler();\n // break;\n default:\n Logger.getInstance().warn('非法的计时器模式');\n handler = new RAFTickHandler();\n break;\n }\n if (!handler.avaliable()) {\n return false;\n }\n\n // 销毁上一个tickerHandler\n if (this.tickerHandler) {\n this.tickerHandler.release();\n }\n this.tickerHandler = handler;\n return true;\n }\n\n setInterval(interval: number) {\n this.interval = interval;\n }\n getInterval(): number {\n return this.interval;\n }\n\n setFPS(fps: number): void {\n this.setInterval(1000 / fps);\n }\n getFPS(): number {\n return 1000 / this.interval;\n }\n tick(interval: number): void {\n this.tickerHandler.tick(interval, (handler: ITickHandler) => {\n this.handleTick(handler, { once: true });\n });\n }\n tickTo(t: number): void {\n if (!this.tickerHandler.tickTo) {\n return;\n }\n this.tickerHandler.tickTo(t, (handler: ITickHandler) => {\n this.handleTick(handler, { once: true });\n });\n }\n pause(): boolean {\n if (this.status === STATUS.INITIAL) {\n return false;\n }\n this.status = STATUS.PAUSE;\n return true;\n }\n resume(): boolean {\n if (this.status === STATUS.INITIAL) {\n return false;\n }\n this.status = STATUS.RUNNING;\n return true;\n }\n\n ifCanStop(): boolean {\n if (this.autoStop) {\n if (!this.timelines.length) {\n return true;\n }\n if (this.timelines.reduce((a, b) => a + b.animateCount, 0) === 0) {\n return true;\n }\n }\n return false;\n }\n\n start(force: boolean = false): boolean {\n if (this.status === STATUS.RUNNING) {\n return false;\n }\n if (!this.tickerHandler) {\n return false;\n }\n // 如果不需要start,那就不start\n if (!force) {\n // 暂停状态不执行\n if (this.status === STATUS.PAUSE) {\n return false;\n }\n if (!this.timelines.length) {\n return false;\n }\n if (this.timelines.reduce((a, b) => a + b.animateCount, 0) === 0) {\n return false;\n }\n }\n this.status = STATUS.RUNNING;\n this.tickerHandler.tick(0, this.handleTick);\n return true;\n }\n stop(): void {\n // 重新设置tickHandler\n this.status = STATUS.INITIAL;\n this.setupTickHandler();\n this.lastFrameTime = -1;\n }\n\n protected handleTick = (handler: ITickHandler, params?: { once?: boolean }) => {\n const { once = false } = params ?? {};\n // 尝试停止\n if (this.ifCanStop()) {\n this.stop();\n return;\n }\n this._handlerTick();\n if (!once) {\n handler.tick(this.interval, this.handleTick);\n }\n };\n\n protected _handlerTick = () => {\n // 具体执行函数\n const tickerHandler = this.tickerHandler;\n const time = tickerHandler.getTime();\n // 上一帧经过的时间\n let delta = 0;\n if (this.lastFrameTime >= 0) {\n delta = time - this.lastFrameTime;\n }\n this.lastFrameTime = time;\n\n if (this.status !== STATUS.RUNNING) {\n return;\n }\n this.tickCounts++;\n\n this.timelines.forEach(t => {\n t.tick(delta);\n });\n this.emit('tick');\n };\n\n release(): void {\n this.stop();\n this.timelines = [];\n this.tickerHandler.release();\n this.emit('afterTick');\n }\n\n /**\n * 同步tick状态,需要手动触发tick执行,保证属性为走完动画的属性\n * 【注】grammar会设置属性到最终值,然后调用render,这时候需要VRender手动触发tick,保证属性为走完动画的属性,而不是Grammar设置上的属性\n */\n trySyncTickStatus() {\n if (this.status === STATUS.RUNNING) {\n this._handlerTick();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC","file":"index.js","sourcesContent":["export * from './default-ticker';\nexport * from './manual-ticker';\nexport * from './manual-ticker-handler';\nexport * from './raf-tick-handler';\nexport * from './timeout-tick-handler';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ITickHandler } from '../../interface/animate';
|
|
2
|
+
export declare class ManualTickHandler implements ITickHandler {
|
|
3
|
+
protected timerId: number;
|
|
4
|
+
protected time: number;
|
|
5
|
+
static Avaliable(): boolean;
|
|
6
|
+
avaliable(): boolean;
|
|
7
|
+
tick(interval: number, cb: (handler: ITickHandler, params?: {
|
|
8
|
+
once: boolean;
|
|
9
|
+
}) => void): void;
|
|
10
|
+
tickTo(t: number, cb: (handler: ITickHandler, params?: {
|
|
11
|
+
once: boolean;
|
|
12
|
+
}) => void): void;
|
|
13
|
+
release(): void;
|
|
14
|
+
getTime(): number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export class ManualTickHandler {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.time = 0;
|
|
4
|
+
}
|
|
5
|
+
static Avaliable() {
|
|
6
|
+
return !0;
|
|
7
|
+
}
|
|
8
|
+
avaliable() {
|
|
9
|
+
return ManualTickHandler.Avaliable();
|
|
10
|
+
}
|
|
11
|
+
tick(interval, cb) {
|
|
12
|
+
this.time = Math.max(0, interval + this.time), cb(this, {
|
|
13
|
+
once: !0
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
tickTo(t, cb) {
|
|
17
|
+
this.time = Math.max(0, t), cb(this, {
|
|
18
|
+
once: !0
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
release() {
|
|
22
|
+
this.timerId > 0 && (this.timerId = -1);
|
|
23
|
+
}
|
|
24
|
+
getTime() {
|
|
25
|
+
return this.time;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=manual-ticker-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/manual-ticker-handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAA9B;QAEY,SAAI,GAAW,CAAC,CAAC;IA8B7B,CAAC;IA5BC,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,OAAO,iBAAiB,CAAC,SAAS,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,QAAgB,EAAE,EAA+D;QACpF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,CAAS,EAAE,EAA+D;QAC/E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE;YAEpB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;SACnB;IACH,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF","file":"manual-ticker-handler.js","sourcesContent":["import type { ITickHandler } from '../../interface/animate';\n\nexport class ManualTickHandler implements ITickHandler {\n protected timerId: number;\n protected time: number = 0;\n\n static Avaliable(): boolean {\n return true;\n }\n\n avaliable(): boolean {\n return ManualTickHandler.Avaliable();\n }\n\n tick(interval: number, cb: (handler: ITickHandler, params?: { once: boolean }) => void): void {\n this.time = Math.max(0, interval + this.time);\n cb(this, { once: true });\n }\n\n tickTo(t: number, cb: (handler: ITickHandler, params?: { once: boolean }) => void): void {\n this.time = Math.max(0, t);\n cb(this, { once: true });\n }\n\n release() {\n if (this.timerId > 0) {\n // clearTimeout(this.timerId);\n this.timerId = -1;\n }\n }\n\n getTime() {\n return this.time;\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ITicker, ITickHandler, ITimeline } from '../../interface/animate';
|
|
2
|
+
import { DefaultTicker } from './default-ticker';
|
|
3
|
+
import type { STATUS, TickerMode } from './type';
|
|
4
|
+
export declare class ManualTicker extends DefaultTicker implements ITicker {
|
|
5
|
+
protected interval: number;
|
|
6
|
+
protected tickerHandler: ITickHandler;
|
|
7
|
+
protected _mode: TickerMode;
|
|
8
|
+
protected status: STATUS;
|
|
9
|
+
protected lastFrameTime: number;
|
|
10
|
+
protected tickCounts: number;
|
|
11
|
+
protected timelines: ITimeline[];
|
|
12
|
+
autoStop: boolean;
|
|
13
|
+
set mode(m: TickerMode);
|
|
14
|
+
get mode(): TickerMode;
|
|
15
|
+
protected initHandler(): ITickHandler | null;
|
|
16
|
+
protected setupTickHandler(): boolean;
|
|
17
|
+
tickAt(time: number): void;
|
|
18
|
+
ifCanStop(): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DefaultTicker } from "./default-ticker";
|
|
2
|
+
|
|
3
|
+
import { ManualTickHandler } from "./manual-ticker-handler";
|
|
4
|
+
|
|
5
|
+
export class ManualTicker extends DefaultTicker {
|
|
6
|
+
set mode(m) {
|
|
7
|
+
this.setupTickHandler();
|
|
8
|
+
}
|
|
9
|
+
get mode() {
|
|
10
|
+
return this._mode;
|
|
11
|
+
}
|
|
12
|
+
initHandler() {
|
|
13
|
+
return this.mode = "manual", null;
|
|
14
|
+
}
|
|
15
|
+
setupTickHandler() {
|
|
16
|
+
const handler = new ManualTickHandler;
|
|
17
|
+
return this._mode = "manual", this.tickerHandler && this.tickerHandler.release(),
|
|
18
|
+
this.tickerHandler = handler, !0;
|
|
19
|
+
}
|
|
20
|
+
tickAt(time) {
|
|
21
|
+
this.tickerHandler.tick(time - Math.max(this.lastFrameTime, 0), (handler => {
|
|
22
|
+
this.handleTick(handler, {
|
|
23
|
+
once: !0
|
|
24
|
+
});
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
ifCanStop() {
|
|
28
|
+
return !1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=manual-ticker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/manual-ticker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,MAAM,OAAO,YAAa,SAAQ,aAAa;IAU7C,IAAI,IAAI,CAAC,CAAa;QACpB,CAAC,GAAG,QAAQ,CAAC;QACb,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAES,WAAW;QACnB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAMS,gBAAgB;QACxB,MAAM,OAAO,GAAiB,IAAI,iBAAiB,EAAE,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;QAGtB,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;SAC9B;QACD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,OAAqB,EAAE,EAAE;YACxF,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;CACF","file":"manual-ticker.js","sourcesContent":["import type { ITicker, ITickHandler, ITimeline } from '../../interface/animate';\nimport { DefaultTicker } from './default-ticker';\nimport { ManualTickHandler } from './manual-ticker-handler';\nimport type { STATUS, TickerMode } from './type';\n\nexport class ManualTicker extends DefaultTicker implements ITicker {\n protected declare interval: number;\n protected declare tickerHandler: ITickHandler;\n protected declare _mode: TickerMode;\n protected declare status: STATUS;\n protected declare lastFrameTime: number;\n protected declare tickCounts: number;\n protected declare timelines: ITimeline[];\n declare autoStop: boolean;\n\n set mode(m: TickerMode) {\n m = 'manual';\n this.setupTickHandler();\n }\n get mode(): TickerMode {\n return this._mode;\n }\n\n protected initHandler(): ITickHandler | null {\n this.mode = 'manual';\n return null;\n }\n\n /**\n * 设置tickHandler\n * @returns 返回true表示设置成功,false表示设置失败\n */\n protected setupTickHandler(): boolean {\n const handler: ITickHandler = new ManualTickHandler();\n this._mode = 'manual';\n\n // 销毁上一个tickerHandler\n if (this.tickerHandler) {\n this.tickerHandler.release();\n }\n this.tickerHandler = handler;\n return true;\n }\n\n tickAt(time: number) {\n this.tickerHandler.tick(time - Math.max(this.lastFrameTime, 0), (handler: ITickHandler) => {\n this.handleTick(handler, { once: true });\n });\n }\n\n ifCanStop(): boolean {\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ITickHandler } from '../../interface/animate';
|
|
2
|
+
export declare class RAFTickHandler implements ITickHandler {
|
|
3
|
+
protected released: boolean;
|
|
4
|
+
static Avaliable(): boolean;
|
|
5
|
+
avaliable(): boolean;
|
|
6
|
+
tick(interval: number, cb: (handler: ITickHandler) => void): void;
|
|
7
|
+
release(): void;
|
|
8
|
+
getTime(): number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { application } from "../../application";
|
|
2
|
+
|
|
3
|
+
export class RAFTickHandler {
|
|
4
|
+
static Avaliable() {
|
|
5
|
+
return !!application.global.getRequestAnimationFrame();
|
|
6
|
+
}
|
|
7
|
+
avaliable() {
|
|
8
|
+
return RAFTickHandler.Avaliable();
|
|
9
|
+
}
|
|
10
|
+
tick(interval, cb) {
|
|
11
|
+
application.global.getRequestAnimationFrame()((() => {
|
|
12
|
+
this.released || cb(this);
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
release() {
|
|
16
|
+
this.released = !0;
|
|
17
|
+
}
|
|
18
|
+
getTime() {
|
|
19
|
+
return Date.now();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=raf-tick-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/raf-tick-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,OAAO,cAAc;IAGzB,MAAM,CAAC,SAAS;QACd,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,wBAAwB,EAAE,CAAC;IACzD,CAAC;IACD,SAAS;QACP,OAAO,cAAc,CAAC,SAAS,EAAE,CAAC;IACpC,CAAC;IAED,IAAI,CAAC,QAAgB,EAAE,EAAmC;QACxD,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,wBAAwB,EAAE,CAAC;QAC1D,GAAG,CAAC,GAAG,EAAE;YACP,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,OAAO;aACR;YACD,EAAE,CAAC,IAAI,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;CACF","file":"raf-tick-handler.js","sourcesContent":["import { application } from '../../application';\nimport type { ITickHandler } from '../../interface/animate';\n\nexport class RAFTickHandler implements ITickHandler {\n protected released: boolean;\n\n static Avaliable(): boolean {\n return !!application.global.getRequestAnimationFrame();\n }\n avaliable(): boolean {\n return RAFTickHandler.Avaliable();\n }\n\n tick(interval: number, cb: (handler: ITickHandler) => void): void {\n const raf = application.global.getRequestAnimationFrame();\n raf(() => {\n if (this.released) {\n return;\n }\n cb(this);\n });\n }\n\n release() {\n this.released = true;\n }\n getTime() {\n return Date.now();\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ITickHandler } from '../../interface/animate';
|
|
2
|
+
export declare class TimeOutTickHandler implements ITickHandler {
|
|
3
|
+
protected timerId: number;
|
|
4
|
+
static Avaliable(): boolean;
|
|
5
|
+
avaliable(): boolean;
|
|
6
|
+
tick(interval: number, cb: (handler: ITickHandler) => void): void;
|
|
7
|
+
release(): void;
|
|
8
|
+
getTime(): number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class TimeOutTickHandler {
|
|
2
|
+
static Avaliable() {
|
|
3
|
+
return !0;
|
|
4
|
+
}
|
|
5
|
+
avaliable() {
|
|
6
|
+
return TimeOutTickHandler.Avaliable();
|
|
7
|
+
}
|
|
8
|
+
tick(interval, cb) {
|
|
9
|
+
this.timerId = setTimeout((() => {
|
|
10
|
+
cb(this);
|
|
11
|
+
}), interval);
|
|
12
|
+
}
|
|
13
|
+
release() {
|
|
14
|
+
this.timerId > 0 && (clearTimeout(this.timerId), this.timerId = -1);
|
|
15
|
+
}
|
|
16
|
+
getTime() {
|
|
17
|
+
return Date.now();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=timeout-tick-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/timeout-tick-handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kBAAkB;IAG7B,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,OAAO,kBAAkB,CAAC,SAAS,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,QAAgB,EAAE,EAAmC;QACxD,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,EAAE,CAAC,IAAI,CAAC,CAAC;QACX,CAAC,EAAE,QAAQ,CAAsB,CAAC;IACpC,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE;YACpB,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;SACnB;IACH,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;CACF","file":"timeout-tick-handler.js","sourcesContent":["import type { ITickHandler } from '../../interface/animate';\n\nexport class TimeOutTickHandler implements ITickHandler {\n protected timerId: number;\n\n static Avaliable(): boolean {\n return true;\n }\n\n avaliable(): boolean {\n return TimeOutTickHandler.Avaliable();\n }\n\n tick(interval: number, cb: (handler: ITickHandler) => void): void {\n this.timerId = setTimeout(() => {\n cb(this);\n }, interval) as unknown as number;\n }\n\n release() {\n if (this.timerId > 0) {\n clearTimeout(this.timerId);\n this.timerId = -1;\n }\n }\n getTime() {\n return Date.now();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animate/Ticker/type.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,yCAAW,CAAA;IACX,yCAAW,CAAA;IACX,qCAAS,CAAA;AACX,CAAC,EAJW,MAAM,KAAN,MAAM,QAIjB","file":"type.js","sourcesContent":["export type TickerMode = 'raf' | 'timeout' | 'manual';\n\nexport enum STATUS {\n INITIAL = 0, // initial表示初始状态\n RUNNING = 1, // running表示正在执行\n PAUSE = 2 // PULSE表示tick还是继续,只是不执行函数了\n}\n"]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { EasingType, EasingTypeFunc, IAnimate, IAnimateStepType, IAnimateTarget, ICustomAnimate, IStep, IStepConfig, ISubAnimate, ITimeline } from '../interface';
|
|
2
|
+
import { AnimateMode, AnimateStatus } from '../common/enums';
|
|
3
|
+
export declare abstract class ACustomAnimate<T> implements ICustomAnimate {
|
|
4
|
+
from: T;
|
|
5
|
+
to: T;
|
|
6
|
+
duration: number;
|
|
7
|
+
easing: EasingType;
|
|
8
|
+
params: any;
|
|
9
|
+
target: IAnimateTarget;
|
|
10
|
+
updateCount: number;
|
|
11
|
+
subAnimate: ISubAnimate;
|
|
12
|
+
step?: IStep;
|
|
13
|
+
mode?: AnimateMode;
|
|
14
|
+
_endProps?: any;
|
|
15
|
+
_mergedEndProps?: any;
|
|
16
|
+
constructor(from: T, to: T, duration: number, easing: EasingType, params?: any);
|
|
17
|
+
bind(target: IAnimateTarget, subAni: ISubAnimate): void;
|
|
18
|
+
onBind(): void;
|
|
19
|
+
onFirstRun(): void;
|
|
20
|
+
onStart(): void;
|
|
21
|
+
onEnd(): void;
|
|
22
|
+
getEndProps(): Record<string, any> | void;
|
|
23
|
+
getFromProps(): Record<string, any> | void;
|
|
24
|
+
getMergedEndProps(): Record<string, any> | void;
|
|
25
|
+
abstract onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
26
|
+
update(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class CbAnimate extends ACustomAnimate<null> {
|
|
29
|
+
cb: () => void;
|
|
30
|
+
constructor(cb: () => void);
|
|
31
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
32
|
+
onStart(): void;
|
|
33
|
+
}
|
|
34
|
+
type InterpolateFunc = (key: string, ratio: number, from: any, to: any, target: IAnimateTarget, out: Record<string, any>) => boolean;
|
|
35
|
+
export declare class Animate implements IAnimate {
|
|
36
|
+
static mode: AnimateMode;
|
|
37
|
+
target: IAnimateTarget;
|
|
38
|
+
timeline: ITimeline;
|
|
39
|
+
nextAnimate?: IAnimate;
|
|
40
|
+
prevAnimate?: IAnimate;
|
|
41
|
+
status: AnimateStatus;
|
|
42
|
+
readonly id: string | number;
|
|
43
|
+
protected _startTime: number;
|
|
44
|
+
protected _duringTime: number;
|
|
45
|
+
subAnimates: SubAnimate[];
|
|
46
|
+
tailAnimate: SubAnimate;
|
|
47
|
+
rawPosition: number;
|
|
48
|
+
timeScale: number;
|
|
49
|
+
interpolateFunc: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;
|
|
50
|
+
_onStart?: (() => void)[];
|
|
51
|
+
_onFrame?: ((step: IStep, ratio: number) => void)[];
|
|
52
|
+
_onEnd?: (() => void)[];
|
|
53
|
+
_onRemove?: (() => void)[];
|
|
54
|
+
_preventAttrs?: Set<string>;
|
|
55
|
+
static interpolateMap: Map<string, InterpolateFunc>;
|
|
56
|
+
slience?: boolean;
|
|
57
|
+
constructor(id?: string | number, timeline?: ITimeline, slience?: boolean);
|
|
58
|
+
setTimeline(timeline: ITimeline): void;
|
|
59
|
+
getStartTime(): number;
|
|
60
|
+
getDuration(): number;
|
|
61
|
+
after(animate: IAnimate): this;
|
|
62
|
+
afterAll(list: IAnimate[]): this;
|
|
63
|
+
parallel(animate: IAnimate): this;
|
|
64
|
+
static AddInterpolate(name: string, cb: InterpolateFunc): void;
|
|
65
|
+
play(customAnimate: ICustomAnimate): this;
|
|
66
|
+
trySetAttribute(attr: Record<string, any> | void, mode?: AnimateMode): void;
|
|
67
|
+
runCb(cb: (a: IAnimate, step: IStep) => void): this;
|
|
68
|
+
customInterpolate(key: string, ratio: number, from: any, to: any, target: IAnimateTarget, ret: Record<string, any>): boolean;
|
|
69
|
+
pause(): void;
|
|
70
|
+
resume(): void;
|
|
71
|
+
to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig): this;
|
|
72
|
+
from(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig): this;
|
|
73
|
+
wait(duration: number): this;
|
|
74
|
+
startAt(t: number): this;
|
|
75
|
+
loop(l: number): this;
|
|
76
|
+
reversed(r: boolean): this;
|
|
77
|
+
bounce(b: boolean): this;
|
|
78
|
+
subAnimate(): this;
|
|
79
|
+
getStartProps(): Record<string, any>;
|
|
80
|
+
getEndProps(): Record<string, any>;
|
|
81
|
+
depreventAttr(key: string): void;
|
|
82
|
+
preventAttr(key: string): void;
|
|
83
|
+
preventAttrs(keys: string[]): void;
|
|
84
|
+
validAttr(key: string): boolean;
|
|
85
|
+
bind(target: IAnimateTarget): this;
|
|
86
|
+
advance(delta: number): void;
|
|
87
|
+
setPosition(rawPosition: number): boolean;
|
|
88
|
+
onStart(cb: () => void): void;
|
|
89
|
+
onEnd(cb: () => void): void;
|
|
90
|
+
onRemove(cb: () => void): void;
|
|
91
|
+
onFrame(cb: (step: IStep, ratio: number) => void): void;
|
|
92
|
+
release(): void;
|
|
93
|
+
stop(nextVal?: 'start' | 'end' | Record<string, any>): void;
|
|
94
|
+
}
|
|
95
|
+
export declare class SubAnimate implements ISubAnimate {
|
|
96
|
+
target: IAnimateTarget;
|
|
97
|
+
animate: IAnimate;
|
|
98
|
+
protected stepHead: Step;
|
|
99
|
+
protected stepTail: Step;
|
|
100
|
+
bounce: boolean;
|
|
101
|
+
reversed: boolean;
|
|
102
|
+
loop: number;
|
|
103
|
+
duration: number;
|
|
104
|
+
position: number;
|
|
105
|
+
rawPosition: number;
|
|
106
|
+
dirty: boolean;
|
|
107
|
+
_totalDuration: number;
|
|
108
|
+
_startAt: number;
|
|
109
|
+
_lastStep: IStep;
|
|
110
|
+
_deltaPosition: number;
|
|
111
|
+
get totalDuration(): number;
|
|
112
|
+
constructor(animate: IAnimate, lastSubAnimate?: SubAnimate);
|
|
113
|
+
protected calcAttr(): void;
|
|
114
|
+
bind(target: IAnimateTarget): this;
|
|
115
|
+
play(customAnimate: ICustomAnimate): this;
|
|
116
|
+
to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig): this;
|
|
117
|
+
from(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig): void;
|
|
118
|
+
startAt(t: number): this;
|
|
119
|
+
getStartProps(): any;
|
|
120
|
+
getEndProps(): any;
|
|
121
|
+
getLastStep(): IStep;
|
|
122
|
+
wait(duration: number): this;
|
|
123
|
+
protected _addStep(duration: number, props: any, easingFunc?: EasingTypeFunc): Step;
|
|
124
|
+
protected _appendProps(props: any, step: Step, tempProps?: boolean): void;
|
|
125
|
+
protected _appendCustomAnimate(customAnimate: ICustomAnimate, step: Step): void;
|
|
126
|
+
setPosition(rawPosition: number): boolean;
|
|
127
|
+
protected updatePosition(end: boolean, rev: boolean): void;
|
|
128
|
+
tryCallCustomAnimateLifeCycle(step: IStep, lastStep: IStep, rev: boolean): void;
|
|
129
|
+
getLastPropByName(name: string, step: Step): any;
|
|
130
|
+
protected updateTarget(step: Step, ratio: number, end: boolean): void;
|
|
131
|
+
}
|
|
132
|
+
declare class Step implements IStep {
|
|
133
|
+
prev?: Step;
|
|
134
|
+
duration: number;
|
|
135
|
+
position: number;
|
|
136
|
+
next?: Step;
|
|
137
|
+
props: any;
|
|
138
|
+
parsedProps?: any;
|
|
139
|
+
propKeys?: string[];
|
|
140
|
+
easing?: EasingTypeFunc;
|
|
141
|
+
customAnimate?: ICustomAnimate;
|
|
142
|
+
type: IAnimateStepType;
|
|
143
|
+
constructor(position: number, duration: number, props?: any, easing?: EasingTypeFunc);
|
|
144
|
+
append(step: Step): void;
|
|
145
|
+
getLastProps(): any;
|
|
146
|
+
}
|
|
147
|
+
export {};
|