@visactor/vstory 0.0.7 → 0.0.8-alpha.1
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/constants/character.d.ts +2 -1
- package/cjs/constants/character.js +2 -1
- package/cjs/constants/character.js.map +1 -1
- package/cjs/dsl/story-chart/pie.js +1 -1
- package/cjs/dsl/story-executor/index.js +0 -2
- package/cjs/dsl/story-processor/index.js +1 -1
- package/cjs/dsl/story-processor/processor.js +1 -1
- package/cjs/dsl/types/Datum.js +1 -2
- package/cjs/dsl/types/index.js +1 -1
- package/cjs/dsl/utils/datum.js +1 -1
- package/cjs/dsl/utils/flicker.js +1 -1
- package/cjs/edit/edit-component/image-selection.js +1 -1
- package/cjs/edit/edit-component/index.js +1 -1
- package/cjs/edit/edit-component/layer-edit.js +2 -0
- package/cjs/edit/edit-component/rect-selection.js +1 -1
- package/cjs/edit/edit-component/richtext-selection-common.js +1 -1
- package/cjs/edit/edit-component/richtext-selection.js +1 -1
- package/cjs/edit/edit-component/shape-selection.js +2 -1
- package/cjs/edit/edit-component/text-selection.js +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/interface/type.js +1 -2
- package/cjs/player/processor/component/unit/unit-action.d.ts +11 -0
- package/cjs/player/processor/component/unit/unit-action.js +36 -0
- package/cjs/player/processor/component/unit/unit-action.js.map +1 -0
- package/cjs/player/processor/interface/appear-action.js.map +1 -1
- package/cjs/player/processor/interface/unit-action.d.ts +23 -0
- package/cjs/player/processor/interface/unit-action.js +6 -0
- package/cjs/player/processor/interface/unit-action.js.map +1 -0
- package/cjs/player/processor/processorMap.d.ts +7 -0
- package/cjs/player/processor/processorMap.js +9 -1
- package/cjs/player/processor/processorMap.js.map +1 -1
- package/cjs/scene/action.js +0 -2
- package/cjs/story/canvas/canvas.d.ts +10 -3
- package/cjs/story/canvas/canvas.js +29 -8
- package/cjs/story/canvas/canvas.js.map +1 -1
- package/cjs/story/character/component/characters/character-unit.d.ts +6 -0
- package/cjs/story/character/component/characters/character-unit.js +19 -0
- package/cjs/story/character/component/characters/character-unit.js.map +1 -0
- package/cjs/story/character/component/graphic/unit.d.ts +28 -0
- package/cjs/story/character/component/graphic/unit.js +106 -0
- package/cjs/story/character/component/graphic/unit.js.map +1 -0
- package/cjs/story/index.js +2 -1
- package/cjs/story/index.js.map +1 -1
- package/cjs/story/interface/dsl-interface.d.ts +2 -1
- package/cjs/story/interface/dsl-interface.js.map +1 -1
- package/cjs/story/interface/runtime-interface.d.ts +5 -1
- package/cjs/story/interface/runtime-interface.js.map +1 -1
- package/cjs/story/story.d.ts +1 -1
- package/cjs/story/story.js +6 -3
- package/cjs/story/story.js.map +1 -1
- package/cjs/template/unit/default.d.ts +4 -0
- package/cjs/template/unit/default.js +50 -0
- package/cjs/template/unit/default.js.map +1 -0
- package/cjs/template/unit/index.d.ts +2 -0
- package/cjs/template/unit/index.js +21 -0
- package/cjs/template/unit/index.js.map +1 -0
- package/cjs/template/unit/type.d.ts +51 -0
- package/cjs/template/unit/type.js +6 -0
- package/cjs/template/unit/type.js.map +1 -0
- package/cjs/template/unit/unit.d.ts +3 -0
- package/cjs/template/unit/unit.js +240 -0
- package/cjs/template/unit/unit.js.map +1 -0
- package/dist/index.js +1721 -1040
- package/dist/index.min.js +3 -3
- package/es/constants/character.d.ts +2 -1
- package/es/constants/character.js +2 -1
- package/es/constants/character.js.map +1 -1
- package/es/dsl/story-chart/pie.js +1 -1
- package/es/dsl/story-executor/index.js +0 -2
- package/es/dsl/story-processor/index.js +1 -1
- package/es/dsl/story-processor/processor.js +1 -1
- package/es/dsl/types/Datum.js +1 -2
- package/es/dsl/types/index.js +1 -1
- package/es/dsl/utils/datum.js +1 -1
- package/es/dsl/utils/flicker.js +1 -1
- package/es/edit/edit-component/image-selection.js +1 -1
- package/es/edit/edit-component/index.js +1 -1
- package/es/edit/edit-component/layer-edit.js +2 -0
- package/es/edit/edit-component/rect-selection.js +1 -1
- package/es/edit/edit-component/richtext-selection-common.js +1 -1
- package/es/edit/edit-component/richtext-selection.js +1 -1
- package/es/edit/edit-component/shape-selection.js +2 -1
- package/es/edit/edit-component/text-selection.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +3 -1
- package/es/index.js.map +1 -1
- package/es/interface/type.js +1 -2
- package/es/player/processor/component/unit/unit-action.d.ts +11 -0
- package/es/player/processor/component/unit/unit-action.js +28 -0
- package/es/player/processor/component/unit/unit-action.js.map +1 -0
- package/es/player/processor/interface/appear-action.js.map +1 -1
- package/es/player/processor/interface/unit-action.d.ts +23 -0
- package/es/player/processor/interface/unit-action.js +2 -0
- package/es/player/processor/interface/unit-action.js.map +1 -0
- package/es/player/processor/processorMap.d.ts +7 -0
- package/es/player/processor/processorMap.js +10 -0
- package/es/player/processor/processorMap.js.map +1 -1
- package/es/scene/action.js +0 -2
- package/es/story/canvas/canvas.d.ts +10 -3
- package/es/story/canvas/canvas.js +29 -8
- package/es/story/canvas/canvas.js.map +1 -1
- package/es/story/character/component/characters/character-unit.d.ts +6 -0
- package/es/story/character/component/characters/character-unit.js +15 -0
- package/es/story/character/component/characters/character-unit.js.map +1 -0
- package/es/story/character/component/graphic/unit.d.ts +28 -0
- package/es/story/character/component/graphic/unit.js +103 -0
- package/es/story/character/component/graphic/unit.js.map +1 -0
- package/es/story/index.js +3 -0
- package/es/story/index.js.map +1 -1
- package/es/story/interface/dsl-interface.d.ts +2 -1
- package/es/story/interface/dsl-interface.js.map +1 -1
- package/es/story/interface/runtime-interface.d.ts +5 -1
- package/es/story/interface/runtime-interface.js.map +1 -1
- package/es/story/story.d.ts +1 -1
- package/es/story/story.js +6 -2
- package/es/story/story.js.map +1 -1
- package/es/template/unit/default.d.ts +4 -0
- package/es/template/unit/default.js +48 -0
- package/es/template/unit/default.js.map +1 -0
- package/es/template/unit/index.d.ts +2 -0
- package/es/template/unit/index.js +4 -0
- package/es/template/unit/index.js.map +1 -0
- package/es/template/unit/type.d.ts +51 -0
- package/es/template/unit/type.js +2 -0
- package/es/template/unit/type.js.map +1 -0
- package/es/template/unit/unit.d.ts +3 -0
- package/es/template/unit/unit.js +234 -0
- package/es/template/unit/unit.js.map +1 -0
- package/package.json +25 -24
|
@@ -10,7 +10,8 @@ function(StoryChartType) {
|
|
|
10
10
|
}(StoryChartType = exports.StoryChartType || (exports.StoryChartType = {})), function(StoryComponentType) {
|
|
11
11
|
StoryComponentType.RECT = "Rect", StoryComponentType.SHAPE = "Shape", StoryComponentType.LINE = "Line",
|
|
12
12
|
StoryComponentType.ARC = "Arc", StoryComponentType.PATH = "Path", StoryComponentType.TEXT = "Text",
|
|
13
|
-
StoryComponentType.QIPAO = "Qipao", StoryComponentType.IMAGE = "Image", StoryComponentType.TIMELINE = "Timeline"
|
|
13
|
+
StoryComponentType.QIPAO = "Qipao", StoryComponentType.IMAGE = "Image", StoryComponentType.TIMELINE = "Timeline",
|
|
14
|
+
StoryComponentType.UNIT = "Unit";
|
|
14
15
|
}(StoryComponentType = exports.StoryComponentType || (exports.StoryComponentType = {})),
|
|
15
16
|
function(StoryChartComponentType) {
|
|
16
17
|
StoryChartComponentType.MARK_POINT = "markPoint", StoryChartComponentType.TITLE = "title";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/character.ts"],"names":[],"mappings":";;;AAAA,IAAkB,cAGjB;AAHD,WAAkB,cAAc;IAC9B,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAHiB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAG/B;AAED,IAAY,
|
|
1
|
+
{"version":3,"sources":["../src/constants/character.ts"],"names":[],"mappings":";;;AAAA,IAAkB,cAGjB;AAHD,WAAkB,cAAc;IAC9B,mCAAiB,CAAA;IACjB,2CAAyB,CAAA;AAC3B,CAAC,EAHiB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAG/B;AAED,IAAY,kBAaX;AAbD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,qCAAe,CAAA;IACf,mCAAa,CAAA;IACb,iCAAW,CAAA;IAEX,mCAAa,CAAA;IACb,mCAAa,CAAA;IAEb,qCAAe,CAAA;IACf,qCAAe,CAAA;IACf,2CAAqB,CAAA;IACrB,mCAAa,CAAA;AACf,CAAC,EAbW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAa7B;AAED,IAAkB,uBAGjB;AAHD,WAAkB,uBAAuB;IACvC,mDAAwB,CAAA;IACxB,0CAAe,CAAA;AACjB,CAAC,EAHiB,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGxC","file":"character.js","sourcesContent":["export const enum StoryChartType {\n VCHART = 'VChart',\n RANKINGBAR = 'RankingBar'\n}\n\nexport enum StoryComponentType {\n RECT = 'Rect',\n SHAPE = 'Shape',\n LINE = 'Line',\n ARC = 'Arc',\n // AREA = 'AreaComponent',\n PATH = 'Path',\n TEXT = 'Text',\n // RICH_TEXT = 'RichText',\n QIPAO = 'Qipao',\n IMAGE = 'Image',\n TIMELINE = 'Timeline',\n UNIT = 'Unit'\n}\n\nexport const enum StoryChartComponentType {\n MARK_POINT = 'markPoint',\n TITLE = 'title'\n}\n"]}
|
package/cjs/dsl/types/Datum.js
CHANGED
package/cjs/dsl/types/index.js
CHANGED
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./common"), exports), __exportStar(require("./chart"), exports),
|
|
21
21
|
__exportStar(require("./graphic"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/dsl/utils/datum.js
CHANGED
package/cjs/dsl/utils/flicker.js
CHANGED
|
@@ -32,4 +32,4 @@ class RichTextSelectionCommon extends base_selection_1.BaseSelection {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
exports.RichTextSelectionCommon = RichTextSelectionCommon, (0, vutils_1.mixin)(RichTextSelectionCommon, richtext_1.RichTextMixin);
|
|
35
|
-
//# sourceMappingURL=richtext-selection-common.js.map
|
|
35
|
+
//# sourceMappingURL=richtext-selection-common.js.map
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -23,4 +23,4 @@ const story_1 = require("./story");
|
|
|
23
23
|
|
|
24
24
|
(0, story_1.registerCharacter)(), __exportStar(require("./story"), exports), __exportStar(require("./edit"), exports),
|
|
25
25
|
__exportStar(require("./story/utils/vchart-pick"), exports), __exportStar(require("./story/utils/chart"), exports),
|
|
26
|
-
__exportStar(require("./story/utils/layout"), exports);
|
|
26
|
+
__exportStar(require("./story/utils/layout"), exports), __exportStar(require("./template/unit"), exports);
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAA4C;AAE5C,IAAA,yBAAiB,GAAE,CAAC;AAEpB,0CAAwB;AACxB,yCAAuB;AACvB,4DAA0C;AAC1C,sDAAoC;AACpC,uDAAqC","file":"index.js","sourcesContent":["import { registerCharacter } from './story';\n\nregisterCharacter();\n\nexport * from './story';\nexport * from './edit';\nexport * from './story/utils/vchart-pick';\nexport * from './story/utils/chart';\nexport * from './story/utils/layout';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAA4C;AAE5C,IAAA,yBAAiB,GAAE,CAAC;AAEpB,0CAAwB;AACxB,yCAAuB;AACvB,4DAA0C;AAC1C,sDAAoC;AACpC,uDAAqC;AAErC,kDAAgC","file":"index.js","sourcesContent":["import { registerCharacter } from './story';\n\nregisterCharacter();\n\nexport * from './story';\nexport * from './edit';\nexport * from './story/utils/vchart-pick';\nexport * from './story/utils/chart';\nexport * from './story/utils/layout';\n\nexport * from './template/unit';\n"]}
|
package/cjs/interface/type.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ICharacter } from '../../../../story/character';
|
|
2
|
+
import type { IStyleParams, IUnitStyleAction } from '../../interface/unit-action';
|
|
3
|
+
import { CommonStyleActionProcessor, CommonVisibilityActionProcessor } from '../common-component';
|
|
4
|
+
export declare class UnitVisibilityActionProcessor extends CommonVisibilityActionProcessor {
|
|
5
|
+
name: 'appearOrDisAppear';
|
|
6
|
+
getEffectFunc(effect: string, appear: boolean): typeof import("../../common/scale-processor").scaleIn | typeof import("../../common/move-processor").moveIn | typeof style;
|
|
7
|
+
}
|
|
8
|
+
export declare class UnitStyleActionProcessor extends CommonStyleActionProcessor {
|
|
9
|
+
run(character: ICharacter, actionSpec: IUnitStyleAction): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function style(character: ICharacter, animation: IStyleParams, effect: string): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.style = exports.UnitStyleActionProcessor = exports.UnitVisibilityActionProcessor = void 0;
|
|
6
|
+
|
|
7
|
+
const common_1 = require("../../common/common"), common_component_1 = require("../common-component");
|
|
8
|
+
|
|
9
|
+
class UnitVisibilityActionProcessor extends common_component_1.CommonVisibilityActionProcessor {
|
|
10
|
+
getEffectFunc(effect, appear) {
|
|
11
|
+
return "style" === effect ? style : super.getEffectFunc(effect, appear);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.UnitVisibilityActionProcessor = UnitVisibilityActionProcessor;
|
|
16
|
+
|
|
17
|
+
class UnitStyleActionProcessor extends common_component_1.CommonStyleActionProcessor {
|
|
18
|
+
run(character, actionSpec) {
|
|
19
|
+
style(character, actionSpec.payload.animation, actionSpec.payload.animation.effect);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function style(character, animation, effect) {
|
|
24
|
+
_style((0, common_1.getCharacterByEffect)(character, effect)[0], animation);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _style(graphic, params) {
|
|
28
|
+
const {styleFunc: styleFunc, startIndex: startIndex, endIndex: endIndex, style: style, stagger: {enable: staggerEnable, ratio: staggerRatio = .25}} = params, symbols = graphic.getChildren(), start = null != startIndex ? startIndex : 0, end = null != endIndex ? endIndex : symbols.length - 1;
|
|
29
|
+
symbols.forEach(((symbol, index) => {
|
|
30
|
+
const duration = staggerEnable ? params.duration * staggerRatio : params.duration, delay = staggerEnable ? Math.random() * params.duration * (1 - staggerRatio) : 1;
|
|
31
|
+
styleFunc ? symbol.animate().wait(delay).to(styleFunc(index), duration, params.easing) : index >= start && index <= end && style && symbol.animate().wait(delay).to(style, duration, params.easing);
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.UnitStyleActionProcessor = UnitStyleActionProcessor, exports.style = style;
|
|
36
|
+
//# sourceMappingURL=unit-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/player/processor/component/unit/unit-action.ts"],"names":[],"mappings":";;;AAEA,gDAA2D;AAE3D,0DAAkG;AAElG,MAAa,6BAA8B,SAAQ,kDAA+B;IAGhF,aAAa,CAAC,MAAc,EAAE,MAAe;QAC3C,QAAQ,MAAM,EAAE;YACd,KAAK,OAAO;gBACV,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACF;AAVD,sEAUC;AAED,MAAa,wBAAyB,SAAQ,6CAA0B;IACtE,GAAG,CAAC,SAAqB,EAAE,UAA4B;QACrD,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtF,CAAC;CACF;AAJD,4DAIC;AAED,SAAgB,KAAK,CAAC,SAAqB,EAAE,SAA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AClD,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;SACjE;IACH,CAAC,CAAC,CAAC;AACL,CAAC","file":"unit-action.js","sourcesContent":["import type { IGraphic, ISymbol } from '@visactor/vrender-core';\nimport type { ICharacter } from '../../../../story/character';\nimport { getCharacterByEffect } from '../../common/common';\nimport type { IStyleParams, IUnitStyleAction } from '../../interface/unit-action';\nimport { CommonStyleActionProcessor, CommonVisibilityActionProcessor } from '../common-component';\n\nexport class UnitVisibilityActionProcessor extends CommonVisibilityActionProcessor {\n name: 'appearOrDisAppear';\n\n getEffectFunc(effect: string, appear: boolean) {\n switch (effect) {\n case 'style':\n return style;\n }\n return super.getEffectFunc(effect, appear);\n }\n}\n\nexport class UnitStyleActionProcessor extends CommonStyleActionProcessor {\n run(character: ICharacter, actionSpec: IUnitStyleAction): void {\n style(character, actionSpec.payload.animation, actionSpec.payload.animation.effect);\n }\n}\n\nexport function style(character: ICharacter, animation: IStyleParams, effect: string) {\n const graphics = getCharacterByEffect(character, effect)[0];\n _style(graphics, animation);\n}\n\nfunction _style(graphic: IGraphic, params: IStyleParams) {\n const {\n styleFunc,\n startIndex,\n endIndex,\n style,\n stagger: { enable: staggerEnable, ratio: staggerRatio = 0.25 }\n } = params;\n const symbols = graphic.getChildren();\n const start = startIndex ?? 0;\n const end = endIndex ?? symbols.length - 1;\n symbols.forEach((symbol: ISymbol, index) => {\n const duration = staggerEnable ? params.duration * staggerRatio : params.duration;\n const delay = staggerEnable ? Math.random() * params.duration * (1 - staggerRatio) : 1;\n if (styleFunc) {\n symbol.animate().wait(delay).to(styleFunc(index), duration, params.easing);\n } else if (index >= start && index <= end && style) {\n symbol.animate().wait(delay).to(style, duration, params.easing);\n }\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/processor/interface/appear-action.ts"],"names":[],"mappings":"","file":"appear-action.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport type { IAction, IActionPayload, IAnimationParams } from './common-action';\n\nexport interface IChartVisibilityPayload extends IActionPayload {\n animation: IAnimationParams & {\n oneByOne: boolean;\n /**\n * 柱状图支持: 'grow' | 'fade' | 'bounce'\n * 折线图支持: 'grow' | 'fade'\n * 饼图支持: 'grow' | 'fade' | 'growAngle' | 'growRadius'\n */\n effect: string | string[];\n };\n fade?: { isBaseOpacity?: boolean };\n}\n\nexport interface IChartVisibilityAction extends IAction<IChartVisibilityPayload> {\n action: 'appear';\n}\n\n// components\nexport interface IFadeInParams extends IAnimationParams {\n opacity?: number;\n fade?: {\n /**\n * @default 1\n */\n opacity?: number;\n duration?: number;\n easing?: EasingType;\n /**\n * 作用于全局的透明度\n * @default false\n */\n isBaseOpacity?: string;\n };\n}\n\nexport interface IMoveToParams extends IAnimationParams {\n destination: { x: number; y: number };\n}\n\nexport interface IMoveParams extends IAnimationParams {\n pos?: 'left' | 'right' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';\n move?: {\n /**\n * @default left\n */\n pos?: IMoveParams['pos'];\n /**\n * @default true\n * @description 若为true: 多个图形的move距离不同, duration相同, 使多个图形同时抵达目标位置; 若为false: 多个图形move的距离相同, duration相同, 即可使多个图形达到相同的速度, 以保持图形的相对位置不变.\n */\n isVariableSpeed?: boolean;\n duration?: number;\n easing?: EasingType;\n };\n}\n\nexport interface IScaleToParams extends IAnimationParams {\n scale: { scaleX: number; scaleY: number };\n}\n\nexport interface IScaleInParams extends IAnimationParams {\n ratio?: number;\n scale?: {\n /**\n * @default 1\n */\n ratio?: number;\n duration?: number;\n easing?: EasingType;\n };\n}\n\nexport interface IWipeInParams extends IAnimationParams {\n from?: 'left' | 'right' | 'top' | 'bottom' | 'stroke';\n wipe?: {\n /**\n * @default left\n */\n from?: 'left' | 'right' | 'top' | 'bottom' | 'stroke';\n duration?: number;\n easing?: EasingType;\n };\n}\n\nexport type ITypeWriterParams = IAnimationParams;\nexport interface IComponentAppearPayLoad extends IActionPayload {\n animation: IFadeInParams | IScaleInParams | IWipeInParams;\n}\n\nexport interface IComponentVisibilityAction extends IAction<IComponentAppearPayLoad> {\n action: 'appear' | 'disappear';\n}\n\nexport type AppearOption = Omit<IChartVisibilityAction, 'action' | 'data'>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/player/processor/interface/appear-action.ts"],"names":[],"mappings":"","file":"appear-action.js","sourcesContent":["import type { EasingType, ISymbolGraphicAttribute } from '@visactor/vrender-core';\nimport type { IAction, IActionPayload, IAnimationParams } from './common-action';\n\nexport interface IChartVisibilityPayload extends IActionPayload {\n animation: IAnimationParams & {\n oneByOne: boolean;\n /**\n * 柱状图支持: 'grow' | 'fade' | 'bounce'\n * 折线图支持: 'grow' | 'fade'\n * 饼图支持: 'grow' | 'fade' | 'growAngle' | 'growRadius'\n */\n effect: string | string[];\n };\n fade?: { isBaseOpacity?: boolean };\n}\n\nexport interface IChartVisibilityAction extends IAction<IChartVisibilityPayload> {\n action: 'appear';\n}\n\n// components\nexport interface IFadeInParams extends IAnimationParams {\n opacity?: number;\n fade?: {\n /**\n * @default 1\n */\n opacity?: number;\n duration?: number;\n easing?: EasingType;\n /**\n * 作用于全局的透明度\n * @default false\n */\n isBaseOpacity?: string;\n };\n}\n\nexport interface IMoveToParams extends IAnimationParams {\n destination: { x: number; y: number };\n}\n\nexport interface IMoveParams extends IAnimationParams {\n pos?: 'left' | 'right' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';\n move?: {\n /**\n * @default left\n */\n pos?: IMoveParams['pos'];\n /**\n * @default true\n * @description 若为true: 多个图形的move距离不同, duration相同, 使多个图形同时抵达目标位置; 若为false: 多个图形move的距离相同, duration相同, 即可使多个图形达到相同的速度, 以保持图形的相对位置不变.\n */\n isVariableSpeed?: boolean;\n duration?: number;\n easing?: EasingType;\n };\n}\n\nexport interface IScaleToParams extends IAnimationParams {\n scale: { scaleX: number; scaleY: number };\n}\n\nexport interface IScaleInParams extends IAnimationParams {\n ratio?: number;\n scale?: {\n /**\n * @default 1\n */\n ratio?: number;\n duration?: number;\n easing?: EasingType;\n };\n}\n\nexport interface IWipeInParams extends IAnimationParams {\n from?: 'left' | 'right' | 'top' | 'bottom' | 'stroke';\n wipe?: {\n /**\n * @default left\n */\n from?: 'left' | 'right' | 'top' | 'bottom' | 'stroke';\n duration?: number;\n easing?: EasingType;\n };\n}\n\nexport type ITypeWriterParams = IAnimationParams;\nexport interface IComponentAppearPayLoad extends IActionPayload {\n animation: IFadeInParams | IScaleInParams | IWipeInParams;\n}\n\nexport interface IComponentVisibilityAction extends IAction<IComponentAppearPayLoad> {\n action: 'appear' | 'disappear';\n}\n\nexport type AppearOption = Omit<IChartVisibilityAction, 'action' | 'data'>;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ISymbolGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import type { IAction, IActionPayload, IAnimationParams } from './common-action';
|
|
3
|
+
export interface IStyleParams extends IAnimationParams {
|
|
4
|
+
effect: 'style';
|
|
5
|
+
stagger?: {
|
|
6
|
+
enable?: boolean;
|
|
7
|
+
ratio?: number;
|
|
8
|
+
};
|
|
9
|
+
startIndex?: number;
|
|
10
|
+
endIndex?: number;
|
|
11
|
+
style?: ISymbolGraphicAttribute;
|
|
12
|
+
styleFunc?: (index: number) => ISymbolGraphicAttribute;
|
|
13
|
+
}
|
|
14
|
+
export interface IComponentUnitStylePayload extends IActionPayload {
|
|
15
|
+
animation: IStyleParams;
|
|
16
|
+
}
|
|
17
|
+
export interface IUnitStyleAction extends IAction<IComponentUnitStylePayload> {
|
|
18
|
+
action: 'style';
|
|
19
|
+
payload: IComponentUnitStylePayload;
|
|
20
|
+
}
|
|
21
|
+
export interface IUnitVisibilityAction extends IAction<IComponentUnitStylePayload> {
|
|
22
|
+
action: 'appear';
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/player/processor/interface/unit-action.ts"],"names":[],"mappings":"","file":"unit-action.js","sourcesContent":["import type { ISymbolGraphicAttribute } from '@visactor/vrender-core';\nimport type { IAction, IActionPayload, IAnimationParams } from './common-action';\n\nexport interface IStyleParams extends IAnimationParams {\n effect: 'style';\n stagger?: {\n /**\n * @description Stagger the animation of multiple elements\n * @default false\n */\n enable?: boolean;\n /**\n * @description The ratio of real animation duration to the total duration\n * @default 1/4\n */\n ratio?: number;\n };\n startIndex?: number;\n endIndex?: number;\n style?: ISymbolGraphicAttribute;\n styleFunc?: (index: number) => ISymbolGraphicAttribute;\n}\n\nexport interface IComponentUnitStylePayload extends IActionPayload {\n animation: IStyleParams;\n}\n\nexport interface IUnitStyleAction extends IAction<IComponentUnitStylePayload> {\n action: 'style';\n payload: IComponentUnitStylePayload;\n}\n\nexport interface IUnitVisibilityAction extends IAction<IComponentUnitStylePayload> {\n action: 'appear';\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { TextVisibilityActionProcessor } from './component/text/text-visibility'
|
|
|
7
7
|
import { TimelineStateActionProcessor, TimelineVisibilityActionProcessor } from './component/timeline/timeline-visibility';
|
|
8
8
|
import { CommonBounceActionProcessor, CommonMoveToActionProcessor, CommonScaleToActionProcessor, CommonStyleActionProcessor } from './component/common-component';
|
|
9
9
|
import { RankingBarPlayActionProcessor } from './chart/rankingBar/rankingBar';
|
|
10
|
+
import { UnitVisibilityActionProcessor, UnitStyleActionProcessor } from './component/unit/unit-action';
|
|
10
11
|
export declare const processorChartMap: {
|
|
11
12
|
VChart: {
|
|
12
13
|
[x: string]: VChartVisibilityActionProcessor | VChartUpdateActionProcessor | VChartAddActionProcessor | CommonBounceActionProcessor;
|
|
@@ -35,6 +36,9 @@ export declare const processorComponentMap: {
|
|
|
35
36
|
Timeline: {
|
|
36
37
|
[x: string]: CommonStyleActionProcessor | CommonMoveToActionProcessor | CommonScaleToActionProcessor | CommonBounceActionProcessor | TimelineVisibilityActionProcessor | TimelineStateActionProcessor;
|
|
37
38
|
};
|
|
39
|
+
Unit: {
|
|
40
|
+
[x: string]: CommonMoveToActionProcessor | CommonScaleToActionProcessor | CommonBounceActionProcessor | UnitVisibilityActionProcessor | UnitStyleActionProcessor;
|
|
41
|
+
};
|
|
38
42
|
};
|
|
39
43
|
export declare const processorMap: {
|
|
40
44
|
Rect: {
|
|
@@ -55,6 +59,9 @@ export declare const processorMap: {
|
|
|
55
59
|
Timeline: {
|
|
56
60
|
[x: string]: CommonStyleActionProcessor | CommonMoveToActionProcessor | CommonScaleToActionProcessor | CommonBounceActionProcessor | TimelineVisibilityActionProcessor | TimelineStateActionProcessor;
|
|
57
61
|
};
|
|
62
|
+
Unit: {
|
|
63
|
+
[x: string]: CommonMoveToActionProcessor | CommonScaleToActionProcessor | CommonBounceActionProcessor | UnitVisibilityActionProcessor | UnitStyleActionProcessor;
|
|
64
|
+
};
|
|
58
65
|
VChart: {
|
|
59
66
|
[x: string]: VChartVisibilityActionProcessor | VChartUpdateActionProcessor | VChartAddActionProcessor | CommonBounceActionProcessor;
|
|
60
67
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.processorMap = exports.processorComponentMap = exports.processorChartMap = void 0;
|
|
6
6
|
|
|
7
|
-
const action_1 = require("../../constants/action"), character_1 = require("../../constants/character"), image_visibility_1 = require("./component/image/image-visibility"), vchart_1 = require("./chart/vchart"), line_visibility_1 = require("./component/line/line-visibility"), rect_visibility_1 = require("./component/rect/rect-visibility"), shape_visibility_1 = require("./component/shape/shape-visibility"), text_visibility_1 = require("./component/text/text-visibility"), timeline_visibility_1 = require("./component/timeline/timeline-visibility"), common_component_1 = require("./component/common-component"), rankingBar_1 = require("./chart/rankingBar/rankingBar");
|
|
7
|
+
const action_1 = require("../../constants/action"), character_1 = require("../../constants/character"), image_visibility_1 = require("./component/image/image-visibility"), vchart_1 = require("./chart/vchart"), line_visibility_1 = require("./component/line/line-visibility"), rect_visibility_1 = require("./component/rect/rect-visibility"), shape_visibility_1 = require("./component/shape/shape-visibility"), text_visibility_1 = require("./component/text/text-visibility"), timeline_visibility_1 = require("./component/timeline/timeline-visibility"), common_component_1 = require("./component/common-component"), rankingBar_1 = require("./chart/rankingBar/rankingBar"), unit_action_1 = require("./component/unit/unit-action");
|
|
8
8
|
|
|
9
9
|
exports.processorChartMap = {
|
|
10
10
|
VChart: {
|
|
@@ -69,6 +69,14 @@ exports.processorChartMap = {
|
|
|
69
69
|
[action_1.ACTION_TYPE.SCALETO]: new common_component_1.CommonScaleToActionProcessor,
|
|
70
70
|
[action_1.ACTION_TYPE.STATE]: new timeline_visibility_1.TimelineStateActionProcessor,
|
|
71
71
|
[action_1.ACTION_TYPE.BOUNCE]: new common_component_1.CommonBounceActionProcessor
|
|
72
|
+
},
|
|
73
|
+
[character_1.StoryComponentType.UNIT]: {
|
|
74
|
+
[action_1.ACTION_TYPE.APPEAR]: new unit_action_1.UnitVisibilityActionProcessor,
|
|
75
|
+
[action_1.ACTION_TYPE.DISAPPEAR]: new unit_action_1.UnitVisibilityActionProcessor,
|
|
76
|
+
[action_1.ACTION_TYPE.STYLE]: new unit_action_1.UnitStyleActionProcessor,
|
|
77
|
+
[action_1.ACTION_TYPE.MOVETO]: new common_component_1.CommonMoveToActionProcessor,
|
|
78
|
+
[action_1.ACTION_TYPE.SCALETO]: new common_component_1.CommonScaleToActionProcessor,
|
|
79
|
+
[action_1.ACTION_TYPE.BOUNCE]: new common_component_1.CommonBounceActionProcessor
|
|
72
80
|
}
|
|
73
81
|
}, exports.processorMap = Object.assign(Object.assign({}, exports.processorChartMap), exports.processorComponentMap);
|
|
74
82
|
//# sourceMappingURL=processorMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/processor/processorMap.ts"],"names":[],"mappings":";;;AAAA,mDAAyE;AACzE,yDAA+E;AAC/E,yEAA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;KACxD;IACD,CAAC,8BAAkB,CAAC,IAAI,CAAC,EAAE;QACzB,CAAC,oBAAW,CAAC,MAAM,CAAC,EAAE,IAAI,2CAA6B,EAAE;QACzD,CAAC,oBAAW,CAAC,SAAS,CAAC,EAAE,IAAI,2CAA6B,EAAE;QAC5D,CAAC,oBAAW,CAAC,KAAK,CAAC,EAAE,IAAI,sCAAwB,EAAE;QACnD,CAAC,oBAAW,CAAC,MAAM,CAAC,EAAE,IAAI,8CAA2B,EAAE;QACvD,CAAC,oBAAW,CAAC,OAAO,CAAC,EAAE,IAAI,+CAA4B,EAAE;QACzD,CAAC,oBAAW,CAAC,MAAM,CAAC,EAAE,IAAI,8CAA2B,EAAE;KACxD;CACF,CAAC;AAEW,QAAA,YAAY,mCACpB,yBAAiB,GACjB,6BAAqB,EACxB","file":"processorMap.js","sourcesContent":["import { ACTION_TYPE, VCHART_ACTION_TYPE } from '../../constants/action';\nimport { StoryChartType, StoryComponentType } from '../../constants/character';\nimport { ImageVisibilityActionProcessor } from './component/image/image-visibility';\nimport { VChartAddActionProcessor, VChartUpdateActionProcessor, VChartVisibilityActionProcessor } from './chart/vchart';\nimport { LineVisibilityActionProcessor } from './component/line/line-visibility';\nimport { RectVisibilityActionProcessor } from './component/rect/rect-visibility';\nimport { ShapeVisibilityActionProcessor } from './component/shape/shape-visibility';\nimport { TextVisibilityActionProcessor } from './component/text/text-visibility';\nimport {\n TimelineStateActionProcessor,\n TimelineVisibilityActionProcessor\n} from './component/timeline/timeline-visibility';\nimport {\n CommonBounceActionProcessor,\n CommonMoveToActionProcessor,\n CommonScaleToActionProcessor,\n CommonStyleActionProcessor\n} from './component/common-component';\nimport { RankingBarPlayActionProcessor } from './chart/rankingBar/rankingBar';\nimport { UnitVisibilityActionProcessor, UnitStyleActionProcessor } from './component/unit/unit-action';\n\nexport const processorChartMap = {\n [StoryChartType.VCHART]: {\n [ACTION_TYPE.APPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor(),\n [VCHART_ACTION_TYPE.UPDATE]: new VChartUpdateActionProcessor(),\n [VCHART_ACTION_TYPE.ADD]: new VChartAddActionProcessor()\n },\n [StoryChartType.RANKINGBAR]: {\n [ACTION_TYPE.APPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new VChartVisibilityActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor(),\n play: new RankingBarPlayActionProcessor()\n }\n};\n\nexport const processorComponentMap = {\n [StoryComponentType.RECT]: {\n [ACTION_TYPE.APPEAR]: new RectVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new RectVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.LINE]: {\n [ACTION_TYPE.APPEAR]: new LineVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new LineVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.SHAPE]: {\n [ACTION_TYPE.APPEAR]: new ShapeVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new ShapeVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.IMAGE]: {\n [ACTION_TYPE.APPEAR]: new ImageVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new ImageVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.TEXT]: {\n [ACTION_TYPE.APPEAR]: new TextVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new TextVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.TIMELINE]: {\n [ACTION_TYPE.APPEAR]: new TimelineVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new TimelineVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new CommonStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.STATE]: new TimelineStateActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n },\n [StoryComponentType.UNIT]: {\n [ACTION_TYPE.APPEAR]: new UnitVisibilityActionProcessor(),\n [ACTION_TYPE.DISAPPEAR]: new UnitVisibilityActionProcessor(),\n [ACTION_TYPE.STYLE]: new UnitStyleActionProcessor(),\n [ACTION_TYPE.MOVETO]: new CommonMoveToActionProcessor(),\n [ACTION_TYPE.SCALETO]: new CommonScaleToActionProcessor(),\n [ACTION_TYPE.BOUNCE]: new CommonBounceActionProcessor()\n }\n};\n\nexport const processorMap = {\n ...processorChartMap,\n ...processorComponentMap\n};\n"]}
|
package/cjs/scene/action.js
CHANGED
|
@@ -8,10 +8,17 @@ export declare class StoryCanvas implements IStoryCanvas {
|
|
|
8
8
|
protected _stage: IStage;
|
|
9
9
|
getStage(): IStage;
|
|
10
10
|
getCanvas(): HTMLCanvasElement;
|
|
11
|
-
protected _container: HTMLDivElement;
|
|
11
|
+
protected _container: HTMLDivElement | null;
|
|
12
12
|
get container(): HTMLDivElement;
|
|
13
|
-
constructor(story: Story,
|
|
14
|
-
|
|
13
|
+
constructor(story: Story, params: {
|
|
14
|
+
container?: HTMLDivElement;
|
|
15
|
+
canvas?: HTMLCanvasElement;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
});
|
|
19
|
+
resize(w: number, h: number): void;
|
|
20
|
+
protected _initCanvasByContainer(): void;
|
|
21
|
+
protected _initCanvasByCanvas(canvas: HTMLCanvasElement, width: number, height: number): void;
|
|
15
22
|
getEventDetail(event: StoryEvent): {
|
|
16
23
|
character: ICharacter;
|
|
17
24
|
characterInfo: undefined;
|
|
@@ -19,25 +19,46 @@ class StoryCanvas {
|
|
|
19
19
|
get container() {
|
|
20
20
|
return this._container;
|
|
21
21
|
}
|
|
22
|
-
constructor(story,
|
|
23
|
-
this._story = story, this._container = container, this.
|
|
22
|
+
constructor(story, params) {
|
|
23
|
+
this._story = story, this._container = params.container, this._container && this._initCanvasByContainer(),
|
|
24
|
+
params.canvas && this._initCanvasByCanvas(params.canvas, params.width || 500, params.height || 500);
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
resize(w, h) {
|
|
27
|
+
this._canvas && (this._canvas.width = w * vrender_1.vglobal.devicePixelRatio, this._canvas.height = h * vrender_1.vglobal.devicePixelRatio,
|
|
28
|
+
this._canvas.style.width = w + "px", this._canvas.style.height = h + "px", this._stage.resize(w, h));
|
|
29
|
+
}
|
|
30
|
+
_initCanvasByContainer() {
|
|
26
31
|
const canvas = document.createElement("canvas");
|
|
27
|
-
canvas.width = this._container.clientWidth * window.devicePixelRatio, canvas.height = this._container.clientHeight * window.devicePixelRatio,
|
|
28
|
-
canvas.style.width = this._container.clientWidth + "px", canvas.style.height = this._container.clientHeight + "px",
|
|
29
32
|
canvas.style.position = "absolute", canvas.id = `_visactor_story_canvas_${this._story.id}`,
|
|
30
33
|
this._container.appendChild(canvas), this._canvas = canvas;
|
|
31
34
|
const stage = (0, vrender_1.createStage)({
|
|
32
35
|
canvas: this._canvas,
|
|
33
|
-
width: this.
|
|
34
|
-
height: this.
|
|
36
|
+
width: this._container.clientWidth,
|
|
37
|
+
height: this._container.clientHeight,
|
|
38
|
+
dpr: vrender_1.vglobal.devicePixelRatio,
|
|
39
|
+
canvasControled: !0,
|
|
40
|
+
autoRender: !0,
|
|
41
|
+
disableDirtyBounds: !0,
|
|
42
|
+
ticker: new vrender_1.ManualTicker([]),
|
|
43
|
+
pluginList: [ "RichTextEditPlugin" ],
|
|
44
|
+
event: {
|
|
45
|
+
clickInterval: 300
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this._stage = stage;
|
|
49
|
+
}
|
|
50
|
+
_initCanvasByCanvas(canvas, width, height) {
|
|
51
|
+
this._canvas = canvas;
|
|
52
|
+
const stage = (0, vrender_1.createStage)({
|
|
53
|
+
canvas: this._canvas,
|
|
54
|
+
width: width,
|
|
55
|
+
height: height,
|
|
35
56
|
canvasControled: !0,
|
|
36
57
|
autoRender: !0,
|
|
37
58
|
disableDirtyBounds: !0,
|
|
38
59
|
ticker: new vrender_1.ManualTicker([]),
|
|
39
60
|
pluginList: [ "RichTextEditPlugin" ],
|
|
40
|
-
dpr:
|
|
61
|
+
dpr: vrender_1.vglobal.devicePixelRatio,
|
|
41
62
|
event: {
|
|
42
63
|
clickInterval: 300
|
|
43
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story/canvas/canvas.ts"],"names":[],"mappings":";;;AAEA,+CAAoG;AACpG,+CAAmD;AAInD,IAAA,0BAAgB,G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O,GAAG,MAAM,CAAC;QACtB,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC;YACxB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,KAAK;YACL,MAAM;YACN,eAAe,EAAE,IAAI;YAErB,UAAU,EAAE,IAAI;YAChB,kBAAkB,EAAE,IAAI;YACxB,MAAM,EAAE,IAAI,sBAAY,CAAC,EAAE,CAAC;YAC5B,UAAU,EAAE,CAAC,oBAAoB,CAAC;YAClC,GAAG,EAAE,iBAAO,CAAC,gBAAgB;YAC7B,KAAK,EAAE;gBACL,aAAa,EAAE,GAAG;aACnB;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,cAAc,CAAC,KAAiB;QAE9B,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QACjD,IAAI,aAAa,CAAC;QAClB,IAAI,SAAqB,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YACjD,MAAM,aAAa,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC;YACvC,MAAM,IAAI,GAAG,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,IAAI,EAAE;gBACR,aAAa,GAAG,IAAI,CAAC;gBACrB,SAAS,GAAG,aAAa,CAAC;gBAC1B,OAAO,IAAI,CAAC;aACb;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,SAAS;YACT,aAAa;SACd,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACF;AAjHD,kCAiHC","file":"canvas.js","sourcesContent":["import type { Story } from '../story';\nimport type { IStage } from '@visactor/vrender';\nimport { createStage, vglobal, container, preLoadAllModule, ManualTicker } from '@visactor/vrender';\nimport { loadBrowserEnv } from '@visactor/vrender';\nimport type { IStoryCanvas, StoryEvent } from '../interface/runtime-interface';\nimport type { ICharacter } from '../character/runtime-interface';\n\npreLoadAllModule();\nloadBrowserEnv(container);\nvglobal.setEnv('browser');\n\nexport class StoryCanvas implements IStoryCanvas {\n protected _story: Story;\n protected _canvas: HTMLCanvasElement;\n protected _stage: IStage;\n getStage() {\n return this._stage;\n }\n\n getCanvas() {\n return this._canvas;\n }\n\n protected _container: HTMLDivElement | null;\n get container() {\n return this._container;\n }\n\n constructor(\n story: Story,\n params: {\n container?: HTMLDivElement;\n canvas?: HTMLCanvasElement;\n width?: number;\n height?: number;\n }\n ) {\n this._story = story;\n this._container = params.container;\n this._container && this._initCanvasByContainer();\n params.canvas && this._initCanvasByCanvas(params.canvas, params.width || 500, params.height || 500);\n }\n\n resize(w: number, h: number) {\n if (this._canvas) {\n this._canvas.width = w * vglobal.devicePixelRatio;\n this._canvas.height = h * vglobal.devicePixelRatio;\n this._canvas.style.width = w + 'px';\n this._canvas.style.height = h + 'px';\n this._stage.resize(w, h);\n }\n }\n\n protected _initCanvasByContainer() {\n const canvas = document.createElement('canvas');\n canvas.style.position = 'absolute';\n canvas.id = `_visactor_story_canvas_${this._story.id}`;\n this._container.appendChild(canvas);\n this._canvas = canvas;\n const stage = createStage({\n canvas: this._canvas,\n width: this._container.clientWidth,\n height: this._container.clientHeight,\n dpr: vglobal.devicePixelRatio,\n canvasControled: true,\n // 得开启自动渲染,否则编辑场景中无法触发视图更新\n autoRender: true,\n disableDirtyBounds: true,\n ticker: new ManualTicker([]),\n pluginList: ['RichTextEditPlugin'],\n event: {\n clickInterval: 300\n }\n });\n // @ts-ignore\n this._stage = stage;\n }\n\n protected _initCanvasByCanvas(canvas: HTMLCanvasElement, width: number, height: number) {\n this._canvas = canvas;\n const stage = createStage({\n canvas: this._canvas,\n width,\n height,\n canvasControled: true,\n // 得开启自动渲染,否则编辑场景中无法触发视图更新\n autoRender: true,\n disableDirtyBounds: true,\n ticker: new ManualTicker([]),\n pluginList: ['RichTextEditPlugin'],\n dpr: vglobal.devicePixelRatio,\n event: {\n clickInterval: 300\n }\n });\n // @ts-ignore\n this._stage = stage;\n }\n\n getEventDetail(event: StoryEvent) {\n // 得到交互元素的详细信息\n const characterMap = this._story.getCharacters();\n let characterInfo;\n let character: ICharacter;\n Object.keys(this._story.getCharacters()).find(id => {\n const characterTemp = characterMap[id];\n const info = characterTemp.checkEvent(event);\n if (info) {\n characterInfo = info;\n character = characterTemp;\n return true;\n }\n return false;\n });\n\n return {\n character,\n characterInfo\n };\n }\n\n release() {\n this._stage.release();\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.CharacterComponentUnit = void 0;
|
|
6
|
+
|
|
7
|
+
const character_1 = require("../character"), character_2 = require("../../../../constants/character"), unit_1 = require("../graphic/unit");
|
|
8
|
+
|
|
9
|
+
class CharacterComponentUnit extends character_1.CharacterComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.graphicType = "unit";
|
|
12
|
+
}
|
|
13
|
+
_createGraphic() {
|
|
14
|
+
return new unit_1.GraphicUnit(character_2.StoryComponentType.UNIT, this);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.CharacterComponentUnit = CharacterComponentUnit;
|
|
19
|
+
//# sourceMappingURL=character-unit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/story/character/component/characters/character-unit.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,+DAAqE;AACrE,0CAA8C;AAE9C,MAAa,sBAAuB,SAAQ,8BAAkB;IAA9D;;QACW,gBAAW,GAAW,MAAM,CAAC;IAIxC,CAAC;IAHW,cAAc;QACtB,OAAO,IAAI,kBAAW,CAAC,8BAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;CACF;AALD,wDAKC","file":"character-unit.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicUnit } from '../graphic/unit';\n\nexport class CharacterComponentUnit extends CharacterComponent {\n readonly graphicType: string = 'unit';\n protected _createGraphic(): Graphic {\n return new GraphicUnit(StoryComponentType.UNIT, this);\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IGroup, type ISymbolGraphicAttribute } from '@visactor/vrender';
|
|
2
|
+
import { Graphic } from './graphic';
|
|
3
|
+
interface IGraphicUnitAttributes {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
padding?: {
|
|
7
|
+
top?: number;
|
|
8
|
+
bottom?: number;
|
|
9
|
+
right?: number;
|
|
10
|
+
left?: number;
|
|
11
|
+
};
|
|
12
|
+
count?: number;
|
|
13
|
+
styleFunc?: (index: number) => ISymbolGraphicAttribute;
|
|
14
|
+
gap?: [number, number];
|
|
15
|
+
aspect?: number;
|
|
16
|
+
direction?: 'horizontal' | 'vertical';
|
|
17
|
+
}
|
|
18
|
+
export declare class GraphicUnit extends Graphic {
|
|
19
|
+
protected _graphic: IGroup;
|
|
20
|
+
getInitialAttributes(): IGraphicUnitAttributes;
|
|
21
|
+
init(): void;
|
|
22
|
+
private _getContainerSize;
|
|
23
|
+
private _calculateGrid;
|
|
24
|
+
private _calculateMinPrimaryCount;
|
|
25
|
+
private _convergeGrid;
|
|
26
|
+
private _addUnitsToGraphic;
|
|
27
|
+
}
|
|
28
|
+
export {};
|