@vvfx/artis 0.0.1-alpha.0
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/LICENSE +22 -0
- package/dist/artis/artis.d.ts +44 -0
- package/dist/artis/base-artis.d.ts +520 -0
- package/dist/artis/canvas-layer-order.d.ts +19 -0
- package/dist/artis/create-info-to-schema.d.ts +21 -0
- package/dist/artis/index.d.ts +15 -0
- package/dist/artis/operations/index.d.ts +3 -0
- package/dist/artis/operations/operations.d.ts +362 -0
- package/dist/artis/operations/scene-operations.d.ts +26 -0
- package/dist/artis/operations/types.d.ts +39 -0
- package/dist/artis/scene-artis.d.ts +386 -0
- package/dist/artis/screenshot-service.d.ts +83 -0
- package/dist/artis/types.d.ts +130 -0
- package/dist/artis/wiring/index.d.ts +17 -0
- package/dist/artis/wiring/register-commands.d.ts +44 -0
- package/dist/artis/wiring/setup-commands.d.ts +5 -0
- package/dist/artis/wiring/setup-event-bindings.d.ts +16 -0
- package/dist/artis/wiring/setup-keybindings.d.ts +38 -0
- package/dist/artis/wiring/setup-plugins.d.ts +5 -0
- package/dist/artis/wiring/wiring-context.d.ts +34 -0
- package/dist/artis-sdk/artis-sdk.d.ts +1117 -0
- package/dist/artis-sdk/index.d.ts +1 -0
- package/dist/core/asset/asset-manager.d.ts +288 -0
- package/dist/core/asset/index.d.ts +3 -0
- package/dist/core/command/command-service.d.ts +315 -0
- package/dist/core/command/commands/composite-command.d.ts +45 -0
- package/dist/core/command/commands/frame-layout-command.d.ts +81 -0
- package/dist/core/command/commands/frame-layout-mode-command.d.ts +55 -0
- package/dist/core/command/commands/frame-move-in-command.d.ts +54 -0
- package/dist/core/command/commands/frame-move-out-command.d.ts +54 -0
- package/dist/core/command/commands/group-children-detach-command.d.ts +28 -0
- package/dist/core/command/commands/index.d.ts +98 -0
- package/dist/core/command/commands/item-align-command.d.ts +52 -0
- package/dist/core/command/commands/item-create-command.d.ts +66 -0
- package/dist/core/command/commands/item-delete-command.d.ts +40 -0
- package/dist/core/command/commands/item-distribute-command.d.ts +53 -0
- package/dist/core/command/commands/item-group-command.d.ts +41 -0
- package/dist/core/command/commands/item-reorder-command.d.ts +41 -0
- package/dist/core/command/commands/item-replace-source-command.d.ts +48 -0
- package/dist/core/command/commands/item-set-font-family-command.d.ts +46 -0
- package/dist/core/command/commands/item-set-generator-resource-command.d.ts +40 -0
- package/dist/core/command/commands/item-transform-command.d.ts +51 -0
- package/dist/core/command/commands/item-ungroup-command.d.ts +34 -0
- package/dist/core/command/commands/item-update-property-by-create-info-command.d.ts +41 -0
- package/dist/core/command/commands/item-update-property-command.d.ts +82 -0
- package/dist/core/command/commands/mask-commit-command.d.ts +53 -0
- package/dist/core/command/commands/page-auto-layout-command.d.ts +53 -0
- package/dist/core/command/commands/picture-cut-commit-command.d.ts +43 -0
- package/dist/core/command/commands/picture-expand-commit-command.d.ts +35 -0
- package/dist/core/command/commands/scene-switch-command.d.ts +35 -0
- package/dist/core/command/commands/selection-set-command.d.ts +38 -0
- package/dist/core/command/commands/sprite-image-command.d.ts +36 -0
- package/dist/core/command/commands/sprite-text-edit-commit-command.d.ts +43 -0
- package/dist/core/command/commands/state-hand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-cut-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-expand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-mask-command.d.ts +15 -0
- package/dist/core/command/commands/state-image-text-edit-command.d.ts +14 -0
- package/dist/core/command/commands/state-item-create-command.d.ts +34 -0
- package/dist/core/command/commands/state-move-command.d.ts +14 -0
- package/dist/core/command/commands/state-switch-command-base.d.ts +41 -0
- package/dist/core/command/commands/text-move-command.d.ts +47 -0
- package/dist/core/command/commands/text-rotate-command.d.ts +52 -0
- package/dist/core/command/commands/text-scale-command.d.ts +56 -0
- package/dist/core/command/commands/text-update-content-command.d.ts +51 -0
- package/dist/core/command/commands/transform-move-command.d.ts +56 -0
- package/dist/core/command/commands/transform-move-with-frame-change-command.d.ts +80 -0
- package/dist/core/command/commands/transform-move-with-layout-command.d.ts +56 -0
- package/dist/core/command/commands/transform-rotate-command.d.ts +51 -0
- package/dist/core/command/commands/transform-scale-command.d.ts +54 -0
- package/dist/core/command/commands/video-play-command.d.ts +28 -0
- package/dist/core/command/commands/video-source-command.d.ts +39 -0
- package/dist/core/command/commands/viewport-fit-to-box-command.d.ts +37 -0
- package/dist/core/command/commands/viewport-fit-to-items-command.d.ts +43 -0
- package/dist/core/command/commands/viewport-move-command.d.ts +34 -0
- package/dist/core/command/commands/viewport-zoom-command.d.ts +35 -0
- package/dist/core/command/index.d.ts +5 -0
- package/dist/core/command/registry.d.ts +246 -0
- package/dist/core/command/types.d.ts +124 -0
- package/dist/core/element-registry/element-facade.d.ts +35 -0
- package/dist/core/element-registry/element-identity-strategy.d.ts +75 -0
- package/dist/core/element-registry/element-registry.d.ts +72 -0
- package/dist/core/element-registry/index.d.ts +5 -0
- package/dist/core/element-registry/types.d.ts +15 -0
- package/dist/core/gizmo/gizmo-bootstrap.d.ts +70 -0
- package/dist/core/gizmo/gizmo-command-binder.d.ts +55 -0
- package/dist/core/gizmo/gizmo-config-override.d.ts +24 -0
- package/dist/core/gizmo/gizmo-registry.d.ts +39 -0
- package/dist/core/gizmo/index.d.ts +19 -0
- package/dist/core/gizmo/register-gizmo-command-bindings.d.ts +20 -0
- package/dist/core/gizmo/state-gizmo-controller.d.ts +20 -0
- package/dist/core/history/history-manager.d.ts +174 -0
- package/dist/core/history/index.d.ts +1 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/item/base-item.d.ts +154 -0
- package/dist/core/item/card-item.d.ts +91 -0
- package/dist/core/item/default-item-schema.d.ts +20 -0
- package/dist/core/item/effects-item.d.ts +99 -0
- package/dist/core/item/frame-item.d.ts +153 -0
- package/dist/core/item/generator-item.d.ts +114 -0
- package/dist/core/item/group-item.d.ts +51 -0
- package/dist/core/item/index.d.ts +25 -0
- package/dist/core/item/sprite-item.d.ts +80 -0
- package/dist/core/item/text-item.d.ts +171 -0
- package/dist/core/item/types.d.ts +158 -0
- package/dist/core/item/video-item.d.ts +120 -0
- package/dist/core/keybinding/index.d.ts +11 -0
- package/dist/core/keybinding/key-binding-controller.d.ts +44 -0
- package/dist/core/keybinding/key-binding-registry.d.ts +92 -0
- package/dist/core/keybinding/key-binding-store.d.ts +29 -0
- package/dist/core/keybinding/key-matcher.d.ts +24 -0
- package/dist/core/keybinding/types.d.ts +84 -0
- package/dist/core/plugin/index.d.ts +3 -0
- package/dist/core/plugin/io-plugin.d.ts +167 -0
- package/dist/core/plugin/plugin-system.d.ts +77 -0
- package/dist/core/predict/align-predict.d.ts +20 -0
- package/dist/core/predict/base/box-ops.d.ts +40 -0
- package/dist/core/predict/base/index.d.ts +14 -0
- package/dist/core/predict/base/parent-coord.d.ts +29 -0
- package/dist/core/predict/base/schema-box.d.ts +21 -0
- package/dist/core/predict/distribute-predict.d.ts +19 -0
- package/dist/core/predict/frame-layout-predict.d.ts +24 -0
- package/dist/core/predict/index.d.ts +12 -0
- package/dist/core/preferences/index.d.ts +2 -0
- package/dist/core/preferences/user-preferences-manager.d.ts +130 -0
- package/dist/core/quality/error-monitor/error-monitor-facade.d.ts +73 -0
- package/dist/core/quality/error-monitor/error-monitor.d.ts +106 -0
- package/dist/core/quality/error-monitor/index.d.ts +4 -0
- package/dist/core/quality/error-monitor/types.d.ts +198 -0
- package/dist/core/quality/index.d.ts +3 -0
- package/dist/core/quality/perf-monitor/index.d.ts +5 -0
- package/dist/core/quality/perf-monitor/perf-monitor-facade.d.ts +45 -0
- package/dist/core/quality/perf-monitor/perf-monitor.d.ts +60 -0
- package/dist/core/quality/perf-monitor/types.d.ts +66 -0
- package/dist/core/quality/stability-monitor/index.d.ts +5 -0
- package/dist/core/quality/stability-monitor/stability-monitor-facade.d.ts +50 -0
- package/dist/core/quality/stability-monitor/stability-monitor.d.ts +61 -0
- package/dist/core/quality/stability-monitor/types.d.ts +69 -0
- package/dist/core/renderer/background-controller.d.ts +56 -0
- package/dist/core/renderer/index.d.ts +5 -0
- package/dist/core/renderer/player-adapter.d.ts +129 -0
- package/dist/core/renderer/renderer.d.ts +134 -0
- package/dist/core/service/frame-service.d.ts +116 -0
- package/dist/core/service/index.d.ts +9 -0
- package/dist/core/service/interaction-providers.d.ts +20 -0
- package/dist/core/service/interaction-service.d.ts +211 -0
- package/dist/core/service/item-asset-service.d.ts +120 -0
- package/dist/core/service/item-creator-service.d.ts +211 -0
- package/dist/core/service/item-service.d.ts +641 -0
- package/dist/core/service/item-sync-service.d.ts +66 -0
- package/dist/core/service/json-scene-sync-service.d.ts +140 -0
- package/dist/core/service/refresh-animation-base-service.d.ts +1 -0
- package/dist/core/service/scene-data-assembler.d.ts +166 -0
- package/dist/core/service/view-service.d.ts +202 -0
- package/dist/core/state/base-state.d.ts +28 -0
- package/dist/core/state/index.d.ts +6 -0
- package/dist/core/state/presets.d.ts +25 -0
- package/dist/core/state/state-manager.d.ts +50 -0
- package/dist/core/state/types.d.ts +52 -0
- package/dist/core/store/index.d.ts +3 -0
- package/dist/core/store/scene-store.d.ts +194 -0
- package/dist/core/store/store.d.ts +36 -0
- package/dist/core/types/artis-config.d.ts +186 -0
- package/dist/core/types/artis-events.d.ts +101 -0
- package/dist/core/types/frame.d.ts +3 -0
- package/dist/core/types/generator.d.ts +28 -0
- package/dist/core/types/index.d.ts +15 -0
- package/dist/core/types/item-create-info.d.ts +205 -0
- package/dist/core/types/item-property.d.ts +149 -0
- package/dist/core/types/item-reorder.d.ts +12 -0
- package/dist/core/types/item-schema.d.ts +263 -0
- package/dist/core/types/item-set-property.d.ts +48 -0
- package/dist/core/types/page.d.ts +40 -0
- package/dist/core/types/sdk.d.ts +28 -0
- package/dist/core/types/view.d.ts +39 -0
- package/dist/helper/exporter/config.d.ts +18 -0
- package/dist/helper/exporter/const.d.ts +71 -0
- package/dist/helper/exporter/export-media.d.ts +189 -0
- package/dist/helper/exporter/exporter.d.ts +58 -0
- package/dist/helper/exporter/index.d.ts +2 -0
- package/dist/helper/exporter/types.d.ts +194 -0
- package/dist/helper/exporter/utils.d.ts +71 -0
- package/dist/helper/exporter/wav-audio.d.ts +35 -0
- package/dist/helper/html-overlay/anchor-navigation-runtime.d.ts +1 -0
- package/dist/helper/html-overlay/auto-height-layout.d.ts +16 -0
- package/dist/helper/html-overlay/auto-height-runtime.d.ts +40 -0
- package/dist/helper/html-overlay/document-runtime.d.ts +18 -0
- package/dist/helper/html-overlay/document-transform.d.ts +46 -0
- package/dist/helper/html-overlay/dom-order.d.ts +5 -0
- package/dist/helper/html-overlay/host-message-runtime.d.ts +15 -0
- package/dist/helper/html-overlay/html-capture-runtime.d.ts +12 -0
- package/dist/helper/html-overlay/html-card-service.d.ts +287 -0
- package/dist/helper/html-overlay/html-viewport-style.d.ts +6 -0
- package/dist/helper/html-overlay/index.d.ts +1 -0
- package/dist/helper/html-overlay/inline-script-json.d.ts +1 -0
- package/dist/helper/html-overlay/mime-utils.d.ts +13 -0
- package/dist/helper/html-overlay/overlay-transform.d.ts +30 -0
- package/dist/helper/html-overlay/path-utils.d.ts +34 -0
- package/dist/helper/html-overlay/runtime-context.d.ts +2 -0
- package/dist/helper/html-overlay/shell-runtime.d.ts +13 -0
- package/dist/helper/index.d.ts +5 -0
- package/dist/helper/scene-builder.d.ts +111 -0
- package/dist/helper/screen-shot.d.ts +51 -0
- package/dist/helper/size-adapt.d.ts +88 -0
- package/dist/index.cjs +69350 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +68963 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/player.d.ts +9 -0
- package/dist/utils/background-manager.d.ts +76 -0
- package/dist/utils/common-utils.d.ts +39 -0
- package/dist/utils/container-size.d.ts +7 -0
- package/dist/utils/find-player-item.d.ts +9 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/json-data-utils.d.ts +198 -0
- package/dist/utils/layout-utils.d.ts +144 -0
- package/dist/utils/pixel-box-utils.d.ts +26 -0
- package/dist/utils/player-data-utils.d.ts +9 -0
- package/dist/utils/player-utils.d.ts +42 -0
- package/dist/utils/replay-utils.d.ts +22 -0
- package/dist/utils/types.d.ts +130 -0
- package/package.json +66 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { spec } from '../shared';
|
|
2
|
+
import { type SceneEntry } from '../core/store';
|
|
3
|
+
import { type ArtisItem } from '../core/item';
|
|
4
|
+
import { type SceneDataAssembler } from '../core/service';
|
|
5
|
+
/**
|
|
6
|
+
* 远程 / 字符串 / 对象 → JSONScene 的解析结果
|
|
7
|
+
*/
|
|
8
|
+
export type SceneSource = spec.JSONScene | string;
|
|
9
|
+
/**
|
|
10
|
+
* 单个视图(场景b:一 JSON 在不同尺寸容器中渲染,含安全区)
|
|
11
|
+
*/
|
|
12
|
+
export type SceneView = {
|
|
13
|
+
/** 视图尺寸 [width, height] */
|
|
14
|
+
viewSize: [number, number];
|
|
15
|
+
/** 出血安全区 [top, bottom, left, right] */
|
|
16
|
+
safeArea?: [number, number, number, number];
|
|
17
|
+
/** 适配方向 */
|
|
18
|
+
direction?: 'x' | 'y';
|
|
19
|
+
/** 采样帧(gotoAndStop 冻结帧) */
|
|
20
|
+
tick?: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 单个 Galacean/effects 产物源
|
|
24
|
+
*
|
|
25
|
+
* - `views` 为空 → 直接以 JSON 单场景加载,主视口=previewSize 自适应(场景a/c)
|
|
26
|
+
* - `views` 非空 → 每个 view 各成一个场景变体(按 viewSize,配合 sizeAdapt 开关决定是否做 SizeAdapt,场景b)
|
|
27
|
+
*/
|
|
28
|
+
export type SceneSourceInput = {
|
|
29
|
+
/** Galacean/effects 产物 JSON 对象或 URL */
|
|
30
|
+
url: SceneSource;
|
|
31
|
+
/** 视图列表(场景b);缺省则该源仅产一个原始场景 */
|
|
32
|
+
views?: SceneView[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* SceneBuilder - 把多个 JSON 源(含各自自适应参数)构建为 SceneEntry[]
|
|
36
|
+
*
|
|
37
|
+
* 承载方案 §10「一 JSON 多场景生成」:
|
|
38
|
+
* - origin 场景:原始 JSON 直接作为一个 SceneEntry
|
|
39
|
+
* - adapted 场景:每组 AdaptConfig → SizeAdapt.adjustment 产生一个新的 JSONScene → 独立 SceneEntry
|
|
40
|
+
* - 多 JSON 源:各自走上述路径,结果都进同一 SceneStore
|
|
41
|
+
*
|
|
42
|
+
* runtime 装配(loadScene + gotoAndStop + SceneDataAssembler)依赖真实 Player 环境,
|
|
43
|
+
* 通过 {@link SceneBuilderDeps} 注入装配函数,使编排逻辑可单测;真实 Player 接入在 P6/P10。
|
|
44
|
+
*/
|
|
45
|
+
export type SceneBuilderDeps = {
|
|
46
|
+
/**
|
|
47
|
+
* 解析 JSON 源(对象直返、字符串按 URL fetch)为 JSONScene
|
|
48
|
+
*/
|
|
49
|
+
resolveScene: (source: SceneSource) => Promise<spec.JSONScene>;
|
|
50
|
+
/**
|
|
51
|
+
* 在一个 JSONScene 上做 headless loadScene + gotoAndStop + assemble,返回 ArtisItem[]
|
|
52
|
+
* 缺省则 items 为空(runtime 环境未就绪时)。
|
|
53
|
+
* 允许同步返回(runtime 已就绪时直接从主 Player 装配)。
|
|
54
|
+
*/
|
|
55
|
+
assemble?: (scene: spec.JSONScene, tick?: number) => ArtisItem[] | Promise<ArtisItem[]>;
|
|
56
|
+
/**
|
|
57
|
+
* SceneDataAssembler 实例(若提供则 assemble 缺省走它)
|
|
58
|
+
*/
|
|
59
|
+
assembler?: SceneDataAssembler;
|
|
60
|
+
};
|
|
61
|
+
export declare class SceneBuilder {
|
|
62
|
+
private _deps;
|
|
63
|
+
/**
|
|
64
|
+
* @param deps 注入的解析/装配依赖
|
|
65
|
+
*/
|
|
66
|
+
constructor(deps: SceneBuilderDeps);
|
|
67
|
+
/**
|
|
68
|
+
* 构建全部场景条目。
|
|
69
|
+
*
|
|
70
|
+
* @param inputs 产物源列表(每个源可带多视图)
|
|
71
|
+
* @param sizeAdaptEnabled 是否启用尺寸自适应。场景b 下:
|
|
72
|
+
* - `true`:每个 view 经 SizeAdapt 对原始 JSON 重排后成独立场景
|
|
73
|
+
* - `false`:每个 view 仅按 viewSize 含原始 JSON(不重排),用于仅切主视口尺寸/安全区的场景
|
|
74
|
+
* @returns SceneEntry[],第一个 origin 的 id 在前;adapted 紧随其同源 origin
|
|
75
|
+
*/
|
|
76
|
+
build(inputs: SceneSourceInput[], sizeAdaptEnabled?: boolean): Promise<SceneEntry[]>;
|
|
77
|
+
/**
|
|
78
|
+
* 用 SizeAdapt 对 origin 做自适应,返回新的 JSONScene(不污染 origin)
|
|
79
|
+
* @param origin 原始 JSON 场景,不会被修改
|
|
80
|
+
* @param cfg 自适应配置(视口尺寸、安全区、方向、tick 等)
|
|
81
|
+
* @returns 自适应后的新 JSONScene
|
|
82
|
+
*/
|
|
83
|
+
private _adapt;
|
|
84
|
+
/**
|
|
85
|
+
* 装配 ArtisItem[]:优先用注入的 assemble,其次用 assembler,否则空数组
|
|
86
|
+
* @param scene JSON 场景
|
|
87
|
+
* @param tick 可选时间戳,传入装配函数用于定位指定时刻
|
|
88
|
+
* @returns 装配出的 ArtisItem 数组;无装配来源时返回空数组
|
|
89
|
+
*/
|
|
90
|
+
private _assemble;
|
|
91
|
+
/**
|
|
92
|
+
* 提取产物预览尺寸作为内容尺寸(主视口范围依据)。
|
|
93
|
+
*
|
|
94
|
+
* 优先取 `compositions[0].previewSize`(产物设计尺寸,驱动主视口);
|
|
95
|
+
* 回退到顶层 items 中 CompositionComponent 的 options.size;再回退默认 1080×1920。
|
|
96
|
+
* @param scene JSON 场景
|
|
97
|
+
* @returns [宽, 高]
|
|
98
|
+
*/
|
|
99
|
+
private _extractContentSize;
|
|
100
|
+
/**
|
|
101
|
+
* 提取场景 CompositionComponent 的 id(优先 item.id,其次 id)
|
|
102
|
+
* @param scene JSON 场景
|
|
103
|
+
* @returns composition id;不存在返回 undefined
|
|
104
|
+
*/
|
|
105
|
+
private _extractCompositionId;
|
|
106
|
+
/**
|
|
107
|
+
* 生成一个全局唯一 id
|
|
108
|
+
* @returns GUID 字符串
|
|
109
|
+
*/
|
|
110
|
+
private _genId;
|
|
111
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { spec } from '../shared';
|
|
2
|
+
/**
|
|
3
|
+
* 截图工具
|
|
4
|
+
*/
|
|
5
|
+
export declare class ScreenShot {
|
|
6
|
+
/**
|
|
7
|
+
* 截图播放器
|
|
8
|
+
*/
|
|
9
|
+
private _player;
|
|
10
|
+
/**
|
|
11
|
+
* 截图播放器容器
|
|
12
|
+
*/
|
|
13
|
+
private _container;
|
|
14
|
+
defaultBackground: spec.vec4;
|
|
15
|
+
/**
|
|
16
|
+
* 初始化截图播放器与画布容器
|
|
17
|
+
*/
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* 生成场景在指定时刻的截图
|
|
21
|
+
* @param scene 场景数据(对象或 URL)
|
|
22
|
+
* @param containerSize 截图播放器画布尺寸
|
|
23
|
+
* @param resultSize 输出图片尺寸
|
|
24
|
+
* @param tick 截图时刻
|
|
25
|
+
* @param background 背景色 rgba,缺省走 defaultBackground
|
|
26
|
+
* @returns 截图 base64 数据
|
|
27
|
+
*/
|
|
28
|
+
generate(scene: spec.JSONScene | string, containerSize: spec.vec2, resultSize: spec.vec2, tick: number, background?: spec.vec4): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* 释放截图播放器资源
|
|
31
|
+
*/
|
|
32
|
+
dispose(): void;
|
|
33
|
+
/**
|
|
34
|
+
* 以 cover 方式将图像绘制到目标矩形(保持比例裁剪溢出部分)
|
|
35
|
+
* @param ctx 2D 绘图上下文
|
|
36
|
+
* @param img 源图像
|
|
37
|
+
* @param x 目标左上角 x
|
|
38
|
+
* @param y 目标左上角 y
|
|
39
|
+
* @param w 目标宽
|
|
40
|
+
* @param h 目标高
|
|
41
|
+
* @param offsetX 源裁剪横向锚点 0-1,缺省 0.5
|
|
42
|
+
* @param offsetY 源裁剪纵向锚点 0-1,缺省 0.5
|
|
43
|
+
* @param sourceRect 源裁剪矩形,缺省取整图
|
|
44
|
+
*/
|
|
45
|
+
drawImageCover(ctx: CanvasRenderingContext2D, img: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, x: number, y: number, w: number, h: number, offsetX?: number, offsetY?: number, sourceRect?: {
|
|
46
|
+
left: number;
|
|
47
|
+
top: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Box2, Vector2, Vector3 } from '@vvfx/gizmo';
|
|
2
|
+
import { Composition, spec, VFXItem } from '../shared';
|
|
3
|
+
export declare enum SizeAdaptDirection {
|
|
4
|
+
X = "x",
|
|
5
|
+
Y = "y"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 尺寸适配工具
|
|
9
|
+
*/
|
|
10
|
+
export declare class SizeAdapt {
|
|
11
|
+
/**
|
|
12
|
+
* 尺寸适配播放器
|
|
13
|
+
*/
|
|
14
|
+
private _player;
|
|
15
|
+
/**
|
|
16
|
+
* 尺寸播放器容器
|
|
17
|
+
*/
|
|
18
|
+
private _container;
|
|
19
|
+
/**
|
|
20
|
+
* 视图大小
|
|
21
|
+
*/
|
|
22
|
+
size: spec.vec2;
|
|
23
|
+
/**
|
|
24
|
+
* 初始化尺寸适配播放器与画布容器
|
|
25
|
+
*/
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
* 按视图尺寸/安全区/方向对场景做自适应,原地修改并返回 scene
|
|
29
|
+
* @param scene JSON 场景(会被原地修改)
|
|
30
|
+
* @param tick 自适应基准时刻
|
|
31
|
+
* @param originSize 原始内容尺寸
|
|
32
|
+
* @param viewSize 目标视图尺寸
|
|
33
|
+
* @param safeArea 安全区 [上, 下, 左, 右],缺省为 0
|
|
34
|
+
* @param direction 自适应方向,缺省按 originSize 宽高比推断
|
|
35
|
+
* @returns 自适应后的 scene
|
|
36
|
+
*/
|
|
37
|
+
adjustment(scene: spec.JSONScene, tick: number, originSize: spec.vec2, viewSize: spec.vec2, safeArea?: spec.vec4, direction?: SizeAdaptDirection): Promise<spec.JSONScene>;
|
|
38
|
+
/**
|
|
39
|
+
* 根据宽高比变化保持上/中/下吸附元素垂直排布距离
|
|
40
|
+
* @param scene JSON 场景(会被原地修改)
|
|
41
|
+
* @param composition 播放器 composition
|
|
42
|
+
* @param ratio 视图与原始宽高比之比
|
|
43
|
+
* @param viewSize 视图尺寸
|
|
44
|
+
*/
|
|
45
|
+
keepDistribute(scene: spec.JSONScene, composition: Composition, ratio: number, viewSize: spec.vec2): void;
|
|
46
|
+
/**
|
|
47
|
+
* 单边/中心吸附自适应:跟随出血区位移缩放并叠加安全区、比例、压板等约束
|
|
48
|
+
* @param type 吸附类型
|
|
49
|
+
* @param scene JSON 场景(会被原地修改)
|
|
50
|
+
* @param composition 播放器 composition
|
|
51
|
+
* @param translation 安全区位移
|
|
52
|
+
* @param originViewBox 原始视图包围盒
|
|
53
|
+
* @param resultViewBox 目标视图包围盒
|
|
54
|
+
* @param adsorptionDirection 主自适应方向
|
|
55
|
+
*/
|
|
56
|
+
keepAdsorption(type: 'centerAdsorption' | 'topAdsorption' | 'bottomAdsorption' | 'leftAdsorption' | 'rightAdsorption', scene: spec.JSONScene, composition: Composition, translation: spec.vec2, originViewBox: Box2, resultViewBox: Box2, adsorptionDirection: SizeAdaptDirection): void;
|
|
57
|
+
/**
|
|
58
|
+
* 下中心双吸附自适应:缩放并强制元素在目标包围盒内(含比例约束)
|
|
59
|
+
* @param type 吸附类型
|
|
60
|
+
* @param scene JSON 场景(会被原地修改)
|
|
61
|
+
* @param composition 播放器 composition
|
|
62
|
+
* @param translation 安全区位移
|
|
63
|
+
* @param originViewBox 原始视图包围盒
|
|
64
|
+
* @param resultViewBox 目标视图包围盒
|
|
65
|
+
* @param adsorptionDirection 主自适应方向
|
|
66
|
+
*/
|
|
67
|
+
keepDoubleAdsorption(type: 'bottomCenterAdsorption', scene: spec.JSONScene, composition: Composition, translation: spec.vec2, originViewBox: Box2, resultViewBox: Box2, adsorptionDirection: SizeAdaptDirection): void;
|
|
68
|
+
/**
|
|
69
|
+
* 计算 headless player 中 item 及其子级的视图包围盒
|
|
70
|
+
* @param targetItem 目标 item
|
|
71
|
+
* @param childrenItem 直接子级列表
|
|
72
|
+
* @param projectPoint 世界坐标到视图坐标的投影函数
|
|
73
|
+
* @returns 包围盒(无内容时为空盒)
|
|
74
|
+
*/
|
|
75
|
+
getViewBoxByHeadlessPlayerItem(targetItem: VFXItem, childrenItem: VFXItem[], projectPoint: (point: Vector3) => Vector2): Box2;
|
|
76
|
+
/**
|
|
77
|
+
* 把增量变换写回场景中对应 item 的 transform 字段
|
|
78
|
+
* @param scene JSON 场景
|
|
79
|
+
* @param itemId 目标 item id
|
|
80
|
+
* @param propertyName 属性名 position/rotation/scale
|
|
81
|
+
* @param propertyValue 增量值
|
|
82
|
+
*/
|
|
83
|
+
transformSceneItem(scene: spec.JSONScene, itemId: string, propertyName: string, propertyValue: any): void;
|
|
84
|
+
/**
|
|
85
|
+
* 释放尺寸适配播放器资源
|
|
86
|
+
*/
|
|
87
|
+
dispose(): void;
|
|
88
|
+
}
|