@tawaship/pixi-animate-runtime 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +452 -2
- package/bin/pixi-animate-runtime.js +27 -0
- package/dist/generator.cjs.js +1056 -0
- package/dist/generator.cjs.js.map +1 -0
- package/dist/pixi-animate-runtime.cjs.js +3678 -0
- package/dist/pixi-animate-runtime.cjs.js.map +1 -0
- package/dist/pixi-animate-runtime.esm.js +3613 -0
- package/dist/pixi-animate-runtime.esm.js.map +1 -0
- package/dist/pixi-animate-runtime.js +3680 -0
- package/dist/pixi-animate-runtime.js.map +1 -0
- package/dist-skills/animate-data-converter-guide/SKILL.md +86 -0
- package/dist-skills/pixi-animate-runtime-guide/SKILL.md +146 -0
- package/package.json +70 -4
- package/tools/pixi-animate-runtime.bat +8 -0
- package/types/generator/generator/cli.d.ts +17 -0
- package/types/generator/generator/converter-version.d.ts +7 -0
- package/types/generator/generator/generate.d.ts +33 -0
- package/types/generator/generator/index.d.ts +6 -0
- package/types/generator/generator/plan.d.ts +87 -0
- package/types/generator/player/data.d.ts +141 -0
- package/types/generator/player/ease.d.ts +11 -0
- package/types/generator/player/semver.d.ts +27 -0
- package/types/generator/player/version.d.ts +2 -0
- package/types/player/animate-container.d.ts +71 -0
- package/types/player/content.d.ts +170 -0
- package/types/player/data.d.ts +141 -0
- package/types/player/display.d.ts +186 -0
- package/types/player/ease.d.ts +11 -0
- package/types/player/events.d.ts +60 -0
- package/types/player/geom.d.ts +19 -0
- package/types/player/index.d.ts +20 -0
- package/types/player/loader.d.ts +53 -0
- package/types/player/movieclip.d.ts +191 -0
- package/types/player/objects.d.ts +320 -0
- package/types/player/semver.d.ts +27 -0
- package/types/player/transform.d.ts +32 -0
- package/types/player/version.d.ts +2 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* createjs-compatible Rectangle (its own members are exactly x, y, width,
|
|
4
|
+
* height, as createjs's; Pixi's Rectangle also carries a shape type).
|
|
5
|
+
*/
|
|
6
|
+
export declare class Rectangle {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
12
|
+
setValues(x?: number, y?: number, width?: number, height?: number): this;
|
|
13
|
+
copy(rect: Rectangle): this;
|
|
14
|
+
clone(): Rectangle;
|
|
15
|
+
contains(x: number, y: number, width?: number, height?: number): boolean;
|
|
16
|
+
isEmpty(): boolean;
|
|
17
|
+
toPixi(): PIXI.Rectangle;
|
|
18
|
+
toString(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Event, EventDispatcher } from './events';
|
|
2
|
+
export type { TEventListener, IEventHandlerObject } from './events';
|
|
3
|
+
export { DisplayObject, Container, PixiContainer } from './display';
|
|
4
|
+
export type { IOwnedNode, IFilterLike, ICacheState } from './display';
|
|
5
|
+
export { CjsTransform } from './transform';
|
|
6
|
+
export { Rectangle } from './geom';
|
|
7
|
+
export { MovieClip, Timeline, TweenState, INDEPENDENT, SINGLE_FRAME, SYNCHED } from './movieclip';
|
|
8
|
+
export type { TScript, TWriter, TMemberWriter, TWrittenValue, ITweenScope, IFilterCacheEntry } from './movieclip';
|
|
9
|
+
export { Shape, Graphics, Sprite, SpriteSheet, Bitmap, Text, ColorFilter, ButtonHelper, GraphicsCommand, GRAPHICS_COMMANDS, PixiGraphics, PixiSprite, PixiText, drawCommands, parseColor, GradientTexture } from './objects';
|
|
10
|
+
export type { ITextureSource, IImageAsset, ISpriteFrame, IButtonTarget, IGradient } from './objects';
|
|
11
|
+
export { Content, tick, resolveState, namespace } from './content';
|
|
12
|
+
export { AnimateContainer, AnimateController } from './animate-container';
|
|
13
|
+
export { loadContentAsync, getContentFactory, resolveContentUrl, CONTENTS_GLOBAL } from './loader';
|
|
14
|
+
export type { IContentTarget, ILoadContentOptions, IContentManifestEntry } from './loader';
|
|
15
|
+
export type { TContentFactory, IGeneratedContent, IContentAssets, IContent, IContentProperties, TContentProperty, ILibrary, TSymbolClass, TMovieClipClass, TSpriteClass, TBitmapClass, TNamespace, ISilentSound } from './content';
|
|
16
|
+
export { RUNTIME_CONTENT_RANGE } from './data';
|
|
17
|
+
export { VERSION } from './version';
|
|
18
|
+
export { parseVersion, compareVersions, satisfies, checkVersion } from './semver';
|
|
19
|
+
export type { IVersionCheck } from './semver';
|
|
20
|
+
export type { IRuntimeData, TRuntimeSymbolDef, IRuntimeMovieClipDef, IRuntimeTweenDef, IRuntimeActionDef, IRuntimeSlotDef, TRuntimeSlotData, TRuntimeSlotRef, IRuntimeTweenData, IRuntimeGraphicsData, TRuntimeCommand, TRuntimeCommandKind, TRuntimeFrameValue } from './data';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IContent, TContentFactory } from './content';
|
|
2
|
+
/**
|
|
3
|
+
* The global runtime content files register their factories in, by
|
|
4
|
+
* composition id: `window.PixiAnimateRuntimeContents[id] = factory`. It is not
|
|
5
|
+
* under the player's namespace, so that a runtime content file can be loaded
|
|
6
|
+
* before the player, and the same file serves every player package.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CONTENTS_GLOBAL = "PixiAnimateRuntimeContents";
|
|
9
|
+
/** What to load a content from: its composition id, and the directory its images are relative to */
|
|
10
|
+
export interface IContentTarget {
|
|
11
|
+
/** The content's composition id (lib.properties.id of the published content) */
|
|
12
|
+
id: string;
|
|
13
|
+
/** The directory the content's image paths are relative to (usually where its runtime content file is) */
|
|
14
|
+
basepath: string;
|
|
15
|
+
options?: {
|
|
16
|
+
/** Whether images are requested with CORS (anonymous). true when omitted */
|
|
17
|
+
crossOrigin?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Called with the content's images before they are loaded (a copy for this
|
|
20
|
+
* load): changing an entry's src changes what is loaded, such as a data: or
|
|
21
|
+
* blob: URL in place of the file
|
|
22
|
+
*/
|
|
23
|
+
handleManifest?: (manifest: IContentManifestEntry[]) => Promise<void> | void;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** An image of a content: its manifest id and its path (relative to the base path, as published) */
|
|
27
|
+
export interface IContentManifestEntry {
|
|
28
|
+
id: string;
|
|
29
|
+
src: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ILoadContentOptions {
|
|
32
|
+
/** Added to every image URL as the query `_fv=<version>` (the query an image path already has stays) */
|
|
33
|
+
version?: string | number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The factory a runtime content file registered under a composition id. The
|
|
37
|
+
* file has to be loaded first (a script tag, or any other way).
|
|
38
|
+
*/
|
|
39
|
+
export declare function getContentFactory(id: string): TContentFactory;
|
|
40
|
+
/**
|
|
41
|
+
* The URL of a content's image: its path resolved against the base path, with
|
|
42
|
+
* the version added as `_fv=<version>` (the query the path already has, such as
|
|
43
|
+
* the one Animate adds on every publish, stays). data: and blob: URLs are used
|
|
44
|
+
* as they are. The same as Pixim.js's utils.resolveUri.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveContentUrl(basepath: string, src: string, version?: string | number | null): string;
|
|
47
|
+
/**
|
|
48
|
+
* Loads contents: the factory each runtime content file registered under the
|
|
49
|
+
* target's composition id (the file has to be loaded already), the content's
|
|
50
|
+
* images from the target's base path, and the content built with them.
|
|
51
|
+
*/
|
|
52
|
+
export declare function loadContentAsync(target: IContentTarget, options?: ILoadContentOptions): Promise<IContent>;
|
|
53
|
+
export declare function loadContentAsync(targets: IContentTarget[], options?: ILoadContentOptions): Promise<IContent[]>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Container, DisplayObject, IOwnedNode } from './display';
|
|
2
|
+
import { Event } from './events';
|
|
3
|
+
import type { IRuntimeTweenDef, IStateEntryDef, TFrameValue, ILabelDef } from './data';
|
|
4
|
+
/** A frame script, called with the clip as `this` */
|
|
5
|
+
export type TScript = (...args: Array<object | string | number | boolean | null>) => void;
|
|
6
|
+
/** A recorded value as written (Graphics references resolved) */
|
|
7
|
+
export type TWrittenValue = object | string | number | boolean | null;
|
|
8
|
+
/**
|
|
9
|
+
* A generated writer: writes the recorded values to the target property by
|
|
10
|
+
* property, the names written out in its code (values[i] to the i-th
|
|
11
|
+
* property; resolve turns a recorded Graphics reference into the Graphics).
|
|
12
|
+
* An initial-value writer has its values in its code and takes the target only.
|
|
13
|
+
*/
|
|
14
|
+
export type TWriter = (target: object, values?: TFrameValue[], resolve?: (value: TFrameValue) => TWrittenValue) => void;
|
|
15
|
+
/** Gives an instance its named children: `self.<name> = slots[<slot>]` for each, the names written in the code */
|
|
16
|
+
export type TMemberWriter = (self: object, slots: object[]) => void;
|
|
17
|
+
/**
|
|
18
|
+
* What a MovieClip instance needs to play a tween of its symbol: how to find
|
|
19
|
+
* the objects a recorded value refers to.
|
|
20
|
+
*/
|
|
21
|
+
export interface ITweenScope {
|
|
22
|
+
/** The target of a state entry (a slot of the instance) */
|
|
23
|
+
stateTarget(entry: IStateEntryDef): DisplayObject | null;
|
|
24
|
+
/** A recorded value as written (Graphics references resolved) */
|
|
25
|
+
value(value: TFrameValue): TWrittenValue;
|
|
26
|
+
/** A frame script by index */
|
|
27
|
+
script(index: number): TScript;
|
|
28
|
+
/** A writer by index */
|
|
29
|
+
writer(index: number): TWriter;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The playback state of one tween of an instance. The values come from the
|
|
33
|
+
* shared definition; only the positions are per instance.
|
|
34
|
+
*/
|
|
35
|
+
export declare class TweenState {
|
|
36
|
+
readonly def: IRuntimeTweenDef;
|
|
37
|
+
/**
|
|
38
|
+
* What the tween writes to: a display object or a filter (through their
|
|
39
|
+
* accessors), or the plain object published code tweens `state` arrays on
|
|
40
|
+
*/
|
|
41
|
+
readonly target: object;
|
|
42
|
+
readonly scope: ITweenScope;
|
|
43
|
+
readonly self: MovieClip;
|
|
44
|
+
position: number;
|
|
45
|
+
rawPosition: number;
|
|
46
|
+
/** Distance from the start of the current step (synched children take their frame from it) */
|
|
47
|
+
_stepPosition: number;
|
|
48
|
+
passive: boolean;
|
|
49
|
+
constructor(def: IRuntimeTweenDef, target: object, scope: ITweenScope, self: MovieClip);
|
|
50
|
+
get duration(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Tween.setPosition as a timeline drives it (actions are run separately by
|
|
53
|
+
* the timeline). Nothing happens when the raw position does not change.
|
|
54
|
+
*/
|
|
55
|
+
setPosition(rawPosition: number, jump: boolean): void;
|
|
56
|
+
private _updatePosition;
|
|
57
|
+
/** AbstractTween._runActions for this tween's actions */
|
|
58
|
+
_runActions(startRaw: number, endRaw: number, jump: boolean, includeStart: boolean): boolean;
|
|
59
|
+
/** Tween._runActionsRange: runs the actions in the range, stopping when one moves the tween */
|
|
60
|
+
_runActionsRange(start: number, end: number, jump: boolean, includeStart: boolean): boolean;
|
|
61
|
+
}
|
|
62
|
+
interface IActionRunner {
|
|
63
|
+
_runActionsRange(start: number, end: number, jump: boolean, includeStart: boolean): boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The timeline of a MovieClip instance (createjs.Timeline as a MovieClip drives it).
|
|
67
|
+
*/
|
|
68
|
+
export declare class Timeline implements IActionRunner {
|
|
69
|
+
readonly tweens: TweenState[];
|
|
70
|
+
readonly duration: number;
|
|
71
|
+
loop: number;
|
|
72
|
+
position: number;
|
|
73
|
+
rawPosition: number;
|
|
74
|
+
private readonly _labels;
|
|
75
|
+
private readonly _labelList;
|
|
76
|
+
constructor(duration: number, labels: ILabelDef[]);
|
|
77
|
+
getLabels(): ILabelDef[];
|
|
78
|
+
get currentLabel(): string | null;
|
|
79
|
+
resolve(positionOrLabel: string | number): number | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* AbstractTween.setPosition for the timeline: moves every tween, calls
|
|
82
|
+
* back (the clip resolves its children), then runs the actions passed.
|
|
83
|
+
*/
|
|
84
|
+
setPosition(rawPosition: number, skipActions: boolean, jump: boolean, callback: (() => void) | null): void;
|
|
85
|
+
_runActionsRange(start: number, end: number, jump: boolean, includeStart: boolean): boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface IFilterCacheEntry {
|
|
88
|
+
instance: DisplayObject;
|
|
89
|
+
startFrame: number;
|
|
90
|
+
endFrame: number;
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
w: number;
|
|
94
|
+
h: number;
|
|
95
|
+
}
|
|
96
|
+
export declare const INDEPENDENT = "independent";
|
|
97
|
+
export declare const SINGLE_FRAME = "single";
|
|
98
|
+
export declare const SYNCHED = "synched";
|
|
99
|
+
/**
|
|
100
|
+
* createjs-compatible MovieClip. Plays its symbol's timeline from the shared
|
|
101
|
+
* definition with createjs's rules: the two phases (tick: advance the
|
|
102
|
+
* playhead; then resolve: write the tweens and settle the children), the
|
|
103
|
+
* write rule (a tween writes only when its position changes), synched /
|
|
104
|
+
* single children taking their frame from the parent's step, the reset of an
|
|
105
|
+
* independent child when it comes back on the display list, and when frame
|
|
106
|
+
* scripts run.
|
|
107
|
+
*/
|
|
108
|
+
export declare class MovieClip extends Container {
|
|
109
|
+
static INDEPENDENT: string;
|
|
110
|
+
static SINGLE_FRAME: string;
|
|
111
|
+
static SYNCHED: string;
|
|
112
|
+
mode: string;
|
|
113
|
+
startPosition: number;
|
|
114
|
+
loop: number;
|
|
115
|
+
currentFrame: number;
|
|
116
|
+
paused: boolean;
|
|
117
|
+
actionsEnabled: boolean;
|
|
118
|
+
autoReset: boolean;
|
|
119
|
+
framerate: number | null;
|
|
120
|
+
timeline: Timeline;
|
|
121
|
+
_synchOffset: number;
|
|
122
|
+
_rawPosition: number;
|
|
123
|
+
_t: number;
|
|
124
|
+
_framerate: number | null;
|
|
125
|
+
/**
|
|
126
|
+
* Display objects the timeline placed, with the resolve that last placed
|
|
127
|
+
* them (_resolveCount at that time). One placed in an earlier resolve and
|
|
128
|
+
* not in the current one is removed at its end (createjs marks every entry
|
|
129
|
+
* 1 at the start of a resolve and placed ones 2: an earlier count is its 1)
|
|
130
|
+
*/
|
|
131
|
+
_managed: {
|
|
132
|
+
[id: number]: number;
|
|
133
|
+
};
|
|
134
|
+
private _resolveCount;
|
|
135
|
+
/**
|
|
136
|
+
* While a resolve can still leave the display list as it is: the index of
|
|
137
|
+
* the child the next placement has to be for that (createjs moves each placed
|
|
138
|
+
* child to the bottom, so in a resolve that changes nothing they come from
|
|
139
|
+
* the top of the placed block down), -1 once all have come. Null when the
|
|
140
|
+
* placements are done as createjs does them.
|
|
141
|
+
*/
|
|
142
|
+
private _expected;
|
|
143
|
+
/** The length of the placed block at the start of the resolve (the children placed last time, at the bottom) */
|
|
144
|
+
private _placedBlock;
|
|
145
|
+
/**
|
|
146
|
+
* Instances to re-cache within frame ranges, read by the filter cache
|
|
147
|
+
* handling (published code sets it in the symbol's constructor)
|
|
148
|
+
*/
|
|
149
|
+
filterCacheList?: IFilterCacheEntry[];
|
|
150
|
+
/** The frame rate the content was published with (lib.properties.fps), set on the content's symbols */
|
|
151
|
+
contentFps: number | null;
|
|
152
|
+
private readonly _boundResolve;
|
|
153
|
+
constructor(mode?: string | null, startPosition?: number | null, loop?: boolean | number | null, timeline?: Timeline, pixi?: IOwnedNode);
|
|
154
|
+
get labels(): ILabelDef[];
|
|
155
|
+
get currentLabel(): string | null;
|
|
156
|
+
get totalFrames(): number;
|
|
157
|
+
get duration(): number;
|
|
158
|
+
isVisible(): boolean;
|
|
159
|
+
play(): void;
|
|
160
|
+
stop(): void;
|
|
161
|
+
gotoAndPlay(positionOrLabel: string | number): void;
|
|
162
|
+
gotoAndStop(positionOrLabel: string | number): void;
|
|
163
|
+
advance(time?: number | null): void;
|
|
164
|
+
/** createjs tick phase: advance the playhead, then the children (reverse), then tick listeners */
|
|
165
|
+
_tick(event: Event): void;
|
|
166
|
+
/** createjs resolve phase (MovieClip draw / Stage update) */
|
|
167
|
+
_updateState(): void;
|
|
168
|
+
_goto(positionOrLabel: string | number): void;
|
|
169
|
+
_reset(): void;
|
|
170
|
+
_updateTimeline(rawPosition: number, jump: boolean): void;
|
|
171
|
+
_renderFirstFrame(): void;
|
|
172
|
+
/**
|
|
173
|
+
* MovieClip._resolveState: places every tween target (and state entry) at
|
|
174
|
+
* the bottom of the display list in turn, then removes the children placed
|
|
175
|
+
* before and not now. The placements are skipped while they would leave the
|
|
176
|
+
* display list as it is (_addManagedChild); otherwise everything is done as
|
|
177
|
+
* createjs does it.
|
|
178
|
+
*/
|
|
179
|
+
_resolveState(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Stops skipping placements: the children placed so far (the top of the
|
|
182
|
+
* block, from the expected index up) are moved to the bottom as createjs's
|
|
183
|
+
* placements would have left them, with no events (moves within the same
|
|
184
|
+
* parent are silent in createjs).
|
|
185
|
+
*/
|
|
186
|
+
_followCreatejs(): void;
|
|
187
|
+
_setState(state: IStateEntryDef[] | object | string | number | boolean | null | undefined, scope: ITweenScope, offset: number): void;
|
|
188
|
+
_addManagedChild(child: DisplayObject, offset: number): void;
|
|
189
|
+
toString(): string;
|
|
190
|
+
}
|
|
191
|
+
export {};
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
import { DisplayObject, Container, IOwnedNode } from './display';
|
|
3
|
+
import { Event } from './events';
|
|
4
|
+
import { Rectangle } from './geom';
|
|
5
|
+
import type { IGraphicsCommandDef, TDataValue } from './data';
|
|
6
|
+
export declare class PixiGraphics extends PIXI.Graphics implements IOwnedNode {
|
|
7
|
+
owner: DisplayObject | null;
|
|
8
|
+
/**
|
|
9
|
+
* Shows another (shared) geometry. Pixi 5 can share a geometry between
|
|
10
|
+
* Graphics (new Graphics(geometry), as clone() does) but has no way to
|
|
11
|
+
* change it afterwards, and does not declare the field that holds it; it is
|
|
12
|
+
* set by name here, and what Pixi derives from the geometry (the batches,
|
|
13
|
+
* their vertices and tint) is marked stale so it is built again.
|
|
14
|
+
*/
|
|
15
|
+
setGeometry(geometry: PIXI.GraphicsGeometry): void;
|
|
16
|
+
/**
|
|
17
|
+
* Pixi 5's Graphics keeps the blend mode in the batches it builds, and
|
|
18
|
+
* builds them again only when the geometry changes: a blend mode set later
|
|
19
|
+
* would not be drawn. The batches are marked stale so they are built again.
|
|
20
|
+
*/
|
|
21
|
+
setBlendMode(mode: PIXI.BLEND_MODES): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class PixiSprite extends PIXI.Sprite implements IOwnedNode {
|
|
24
|
+
owner: DisplayObject | null;
|
|
25
|
+
}
|
|
26
|
+
export declare class PixiText extends PIXI.Text implements IOwnedNode {
|
|
27
|
+
owner: DisplayObject | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Where a content's images come from: manifest images by id, and frames of
|
|
31
|
+
* its sprite sheets (the images published code draws from a frame for a
|
|
32
|
+
* bitmap fill).
|
|
33
|
+
*/
|
|
34
|
+
export interface ITextureSource {
|
|
35
|
+
image(id: string): PIXI.Texture | null;
|
|
36
|
+
frame(sheet: string, index: number): PIXI.Texture | null;
|
|
37
|
+
imageAsset(id: string): IImageAsset | null;
|
|
38
|
+
frameAsset(sheet: string, index: number): IImageAsset | null;
|
|
39
|
+
}
|
|
40
|
+
interface IColor {
|
|
41
|
+
color: number;
|
|
42
|
+
alpha: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A CSS color as createjs writes it (#RGB, #RRGGBB, rgb(), rgba(), a few names).
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseColor(value: TDataValue | undefined): IColor | null;
|
|
48
|
+
/**
|
|
49
|
+
* A linear or radial gradient as createjs makes it (the props of a Fill or
|
|
50
|
+
* Stroke style made by beginLinearGradientFill and the like): colors at
|
|
51
|
+
* ratios along the line from (x0, y0) to (x1, y1), or between the circles
|
|
52
|
+
* (x0, y0, r0) and (x1, y1, r1), in the shape's coordinates.
|
|
53
|
+
*/
|
|
54
|
+
export interface IGradient {
|
|
55
|
+
type: 'linear' | 'radial';
|
|
56
|
+
colors: string[];
|
|
57
|
+
ratios: number[];
|
|
58
|
+
x0: number;
|
|
59
|
+
y0: number;
|
|
60
|
+
r0: number;
|
|
61
|
+
x1: number;
|
|
62
|
+
y1: number;
|
|
63
|
+
r1: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A gradient drawn into a canvas by the browser's own gradient (so its
|
|
67
|
+
* colors are what canvas, and createjs, paints), as a texture that Pixi's
|
|
68
|
+
* Graphics fills and strokes with through a matrix. `gradient` is the
|
|
69
|
+
* gradient in the shape's coordinates, `local` the same gradient in the
|
|
70
|
+
* texture's pixels, and `toShape` takes texture pixels to the shape's
|
|
71
|
+
* coordinates. Outside the drawn area the texture's edge pixels repeat
|
|
72
|
+
* (Pixi clamps), which is how canvas pads a gradient with its end colors.
|
|
73
|
+
*/
|
|
74
|
+
export declare class GradientTexture extends PIXI.Texture {
|
|
75
|
+
readonly gradient: IGradient;
|
|
76
|
+
readonly local: IGradient;
|
|
77
|
+
readonly toShape: PIXI.Matrix;
|
|
78
|
+
constructor(canvas: HTMLCanvasElement, gradient: IGradient, local: IGradient, toShape: PIXI.Matrix);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Draws createjs drawing commands into a Pixi Graphics. Pixi takes the paint
|
|
82
|
+
* first, so each path is replayed under the paint that follows it, with the
|
|
83
|
+
* holes canvas's nonzero fill would cut (holes: the MoveTo commands that
|
|
84
|
+
* start holes, see Graphics.holes).
|
|
85
|
+
*/
|
|
86
|
+
export declare function drawCommands(target: PIXI.Graphics, commands: IGraphicsCommandDef[], textures: ITextureSource, holes?: IGraphicsCommandDef[] | null): void;
|
|
87
|
+
/**
|
|
88
|
+
* A drawing command as createjs keeps it (Graphics.MoveTo, Graphics.Fill, ...):
|
|
89
|
+
* the command's own properties, with fill and stroke styles as objects whose
|
|
90
|
+
* `props` are the arguments they were made with.
|
|
91
|
+
*/
|
|
92
|
+
export declare class GraphicsCommand {
|
|
93
|
+
}
|
|
94
|
+
/** The createjs drawing command class names */
|
|
95
|
+
export declare const GRAPHICS_COMMANDS: string[];
|
|
96
|
+
/**
|
|
97
|
+
* Draws the path of createjs drawing commands filled, ignoring their fills
|
|
98
|
+
* and strokes: the shape a createjs mask clips with (all the drawing as one
|
|
99
|
+
* path, with the holes named by holes, see Graphics.maskHoles).
|
|
100
|
+
*/
|
|
101
|
+
export declare function drawMaskPath(target: PIXI.Graphics, commands: IGraphicsCommandDef[], holes?: IGraphicsCommandDef[] | null): void;
|
|
102
|
+
/**
|
|
103
|
+
* createjs-compatible Graphics holding the drawing commands of a definition.
|
|
104
|
+
*/
|
|
105
|
+
export declare class Graphics {
|
|
106
|
+
readonly commands: IGraphicsCommandDef[];
|
|
107
|
+
readonly textures: ITextureSource;
|
|
108
|
+
private _instructions;
|
|
109
|
+
private _holes;
|
|
110
|
+
private _maskHoles;
|
|
111
|
+
private _geometry;
|
|
112
|
+
private _maskGeometry;
|
|
113
|
+
constructor(commands: IGraphicsCommandDef[], textures: ITextureSource);
|
|
114
|
+
/** The commands as createjs's command objects (made when first read) */
|
|
115
|
+
get instructions(): GraphicsCommand[];
|
|
116
|
+
isEmpty(): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* The MoveTo commands that start holes in the filled paths (worked out once
|
|
119
|
+
* per drawing and shared by every shape that shows it)
|
|
120
|
+
*/
|
|
121
|
+
holes(): IGraphicsCommandDef[];
|
|
122
|
+
/**
|
|
123
|
+
* The drawing as a Pixi geometry, drawn the first time it is asked for and
|
|
124
|
+
* shared from then on by every shape that shows this drawing (a shape's
|
|
125
|
+
* Pixi node must therefore not be drawn into: that would change it for all)
|
|
126
|
+
*/
|
|
127
|
+
geometry(): PIXI.GraphicsGeometry;
|
|
128
|
+
/** The drawing as a mask (its path filled), shared the same way */
|
|
129
|
+
maskGeometry(): PIXI.GraphicsGeometry;
|
|
130
|
+
/** The holes of the drawing as a mask (all of it one path) */
|
|
131
|
+
maskHoles(): IGraphicsCommandDef[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* createjs-compatible Shape on a Pixi Graphics.
|
|
135
|
+
*/
|
|
136
|
+
export declare class Shape extends DisplayObject {
|
|
137
|
+
readonly pixiGraphics: PixiGraphics;
|
|
138
|
+
private _graphics;
|
|
139
|
+
/** The shape as a mask (made when first used as one), a child of this shape's node */
|
|
140
|
+
private _maskGraphics;
|
|
141
|
+
constructor(graphics?: Graphics | null);
|
|
142
|
+
get graphics(): Graphics | null;
|
|
143
|
+
set graphics(value: Graphics | null);
|
|
144
|
+
_clipsAsMask(): boolean;
|
|
145
|
+
_setBlendMode(mode: PIXI.BLEND_MODES): void;
|
|
146
|
+
/**
|
|
147
|
+
* createjs clips with the shape's path alone (Graphics.drawAsPath, then
|
|
148
|
+
* clip), whatever its fill and stroke; published masks are paths with no
|
|
149
|
+
* fill. The mask node is that path, filled. It is a child of the shape's
|
|
150
|
+
* node, so it moves with the shape (the shape's own node is not drawn while
|
|
151
|
+
* it serves as a mask).
|
|
152
|
+
*/
|
|
153
|
+
_pixiMaskNode(): PIXI.Container;
|
|
154
|
+
_releaseMaskNode(): void;
|
|
155
|
+
toString(): string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A frame of a sprite sheet, as createjs describes it.
|
|
159
|
+
*/
|
|
160
|
+
export interface ISpriteFrame {
|
|
161
|
+
image: IImageAsset;
|
|
162
|
+
rect: Rectangle;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* An image as content sees it (`src` names it).
|
|
166
|
+
*/
|
|
167
|
+
export interface IImageAsset {
|
|
168
|
+
src: string;
|
|
169
|
+
texture: PIXI.Texture;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* createjs-compatible SpriteSheet: frames cut from an atlas image.
|
|
173
|
+
*/
|
|
174
|
+
export declare class SpriteSheet {
|
|
175
|
+
readonly frames: ISpriteFrame[];
|
|
176
|
+
readonly textures: PIXI.Texture[];
|
|
177
|
+
framerate: number;
|
|
178
|
+
complete: boolean;
|
|
179
|
+
constructor(image: IImageAsset, rects: number[][]);
|
|
180
|
+
getFrame(index: number): ISpriteFrame | null;
|
|
181
|
+
getNumFrames(): number;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* createjs-compatible Sprite (frame by frame from a sprite sheet).
|
|
185
|
+
*/
|
|
186
|
+
export declare class Sprite extends DisplayObject {
|
|
187
|
+
readonly pixiSprite: PixiSprite;
|
|
188
|
+
spriteSheet: SpriteSheet;
|
|
189
|
+
currentFrame: number;
|
|
190
|
+
paused: boolean;
|
|
191
|
+
framerate: number;
|
|
192
|
+
constructor(spriteSheet: SpriteSheet, frame?: number);
|
|
193
|
+
play(): void;
|
|
194
|
+
stop(): void;
|
|
195
|
+
gotoAndPlay(frame: number): void;
|
|
196
|
+
gotoAndStop(frame: number): void;
|
|
197
|
+
advance(): void;
|
|
198
|
+
_goto(frame: number): void;
|
|
199
|
+
_tick(event: Event): void;
|
|
200
|
+
_setBlendMode(mode: PIXI.BLEND_MODES): void;
|
|
201
|
+
toString(): string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* createjs-compatible Bitmap.
|
|
205
|
+
*/
|
|
206
|
+
export declare class Bitmap extends DisplayObject {
|
|
207
|
+
readonly pixiSprite: PixiSprite;
|
|
208
|
+
private _image;
|
|
209
|
+
private _sourceRect;
|
|
210
|
+
constructor(image?: IImageAsset | null);
|
|
211
|
+
get image(): IImageAsset | null;
|
|
212
|
+
set image(value: IImageAsset | null);
|
|
213
|
+
get sourceRect(): Rectangle | null;
|
|
214
|
+
set sourceRect(value: Rectangle | null);
|
|
215
|
+
private _updateTexture;
|
|
216
|
+
_setBlendMode(mode: PIXI.BLEND_MODES): void;
|
|
217
|
+
toString(): string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The lines createjs draws a text in (Text._drawText): the text split at line
|
|
221
|
+
* breaks (CR LF, CR, LF), then a line wider than lineWidth broken at whitespace
|
|
222
|
+
* only, words added while they fit (a word wider than lineWidth stays whole).
|
|
223
|
+
* No breaking at all when lineWidth is null.
|
|
224
|
+
*/
|
|
225
|
+
export declare function breakLines(text: string, lineWidth: number | null, measure: (line: string) => number): string[];
|
|
226
|
+
/**
|
|
227
|
+
* createjs-compatible Text on a Pixi Text.
|
|
228
|
+
*/
|
|
229
|
+
export declare class Text extends DisplayObject {
|
|
230
|
+
readonly pixiText: PixiText;
|
|
231
|
+
private _text;
|
|
232
|
+
private _font;
|
|
233
|
+
private _color;
|
|
234
|
+
private _textAlign;
|
|
235
|
+
private _textBaseline;
|
|
236
|
+
private _lineHeight;
|
|
237
|
+
private _lineWidth;
|
|
238
|
+
private _maxWidth;
|
|
239
|
+
private _outline;
|
|
240
|
+
constructor(text?: string, font?: string, color?: string);
|
|
241
|
+
get text(): string;
|
|
242
|
+
set text(value: string);
|
|
243
|
+
get font(): string | null;
|
|
244
|
+
set font(value: string | null);
|
|
245
|
+
get color(): string | null;
|
|
246
|
+
set color(value: string | null);
|
|
247
|
+
get textAlign(): string;
|
|
248
|
+
set textAlign(value: string);
|
|
249
|
+
get textBaseline(): string;
|
|
250
|
+
set textBaseline(value: string);
|
|
251
|
+
get lineHeight(): number;
|
|
252
|
+
set lineHeight(value: number);
|
|
253
|
+
get lineWidth(): number | null;
|
|
254
|
+
set lineWidth(value: number | null);
|
|
255
|
+
get maxWidth(): number | null;
|
|
256
|
+
set maxWidth(value: number | null);
|
|
257
|
+
get outline(): number;
|
|
258
|
+
set outline(value: number);
|
|
259
|
+
private _updateText;
|
|
260
|
+
_setBlendMode(mode: PIXI.BLEND_MODES): void;
|
|
261
|
+
toString(): string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* createjs-compatible ColorFilter on a Pixi ColorMatrixFilter.
|
|
265
|
+
*/
|
|
266
|
+
export declare class ColorFilter {
|
|
267
|
+
readonly pixiFilter: PIXI.filters.ColorMatrixFilter;
|
|
268
|
+
private _values;
|
|
269
|
+
constructor(redMultiplier?: number, greenMultiplier?: number, blueMultiplier?: number, alphaMultiplier?: number, redOffset?: number, greenOffset?: number, blueOffset?: number, alphaOffset?: number);
|
|
270
|
+
get redMultiplier(): number;
|
|
271
|
+
set redMultiplier(value: number);
|
|
272
|
+
get greenMultiplier(): number;
|
|
273
|
+
set greenMultiplier(value: number);
|
|
274
|
+
get blueMultiplier(): number;
|
|
275
|
+
set blueMultiplier(value: number);
|
|
276
|
+
get alphaMultiplier(): number;
|
|
277
|
+
set alphaMultiplier(value: number);
|
|
278
|
+
get redOffset(): number;
|
|
279
|
+
set redOffset(value: number);
|
|
280
|
+
get greenOffset(): number;
|
|
281
|
+
set greenOffset(value: number);
|
|
282
|
+
get blueOffset(): number;
|
|
283
|
+
set blueOffset(value: number);
|
|
284
|
+
get alphaOffset(): number;
|
|
285
|
+
set alphaOffset(value: number);
|
|
286
|
+
private _set;
|
|
287
|
+
private _updateMatrix;
|
|
288
|
+
toString(): string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Members ButtonHelper needs from its target (a MovieClip).
|
|
292
|
+
*/
|
|
293
|
+
export interface IButtonTarget extends Container {
|
|
294
|
+
paused: boolean;
|
|
295
|
+
actionsEnabled: boolean;
|
|
296
|
+
gotoAndPlay(frame: string | number): void;
|
|
297
|
+
gotoAndStop(frame: string | number): void;
|
|
298
|
+
_reset(): void;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* createjs-compatible ButtonHelper: sends its target to the out / over /
|
|
302
|
+
* down frames on mouse events, and stops it on the out frame from the start.
|
|
303
|
+
*/
|
|
304
|
+
export declare class ButtonHelper {
|
|
305
|
+
readonly target: IButtonTarget;
|
|
306
|
+
overLabel: string | number;
|
|
307
|
+
outLabel: string | number;
|
|
308
|
+
downLabel: string | number;
|
|
309
|
+
play: boolean;
|
|
310
|
+
_isPressed: boolean;
|
|
311
|
+
_isOver: boolean;
|
|
312
|
+
_enabled: boolean;
|
|
313
|
+
private _originalReset;
|
|
314
|
+
constructor(target: IButtonTarget, outLabel?: string | number | null, overLabel?: string | number | null, downLabel?: string | number | null, play?: boolean, hitArea?: IButtonTarget | null, hitLabel?: string | number | null);
|
|
315
|
+
get enabled(): boolean;
|
|
316
|
+
set enabled(value: boolean);
|
|
317
|
+
handleEvent(event: Event): void;
|
|
318
|
+
toString(): string;
|
|
319
|
+
}
|
|
320
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic version numbers and ranges, as far as the version checks of
|
|
3
|
+
* definitions and runtime content need them: versions are MAJOR.MINOR.PATCH,
|
|
4
|
+
* and ranges are written as npm writes them (`1.2.3`, `1.x`, `^1.2.0`,
|
|
5
|
+
* `~1.2.0`, `>=1.0.0 <2.0.0`, `0.x || 1.x`). Pre-release tags are not handled.
|
|
6
|
+
*/
|
|
7
|
+
type TVersion = [number, number, number];
|
|
8
|
+
/** A version as its three numbers, or null when it is not MAJOR.MINOR.PATCH */
|
|
9
|
+
export declare function parseVersion(text: string): TVersion | null;
|
|
10
|
+
/** -1, 0 or 1 as a is lower than, the same as or higher than b (both have to be versions) */
|
|
11
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
12
|
+
/** Whether a version is in a range (npm's notation, see above); a range not understood throws */
|
|
13
|
+
export declare function satisfies(version: string, range: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether data a reader is given can be read: `error` when its writer's
|
|
16
|
+
* version is outside the range the reader reads, `warning` when it is in the
|
|
17
|
+
* range but newer than the version the reader knows of (the data may hold
|
|
18
|
+
* what the reader does not know and leaves out). Both null when it reads.
|
|
19
|
+
*/
|
|
20
|
+
export interface IVersionCheck {
|
|
21
|
+
error: string | null;
|
|
22
|
+
warning: string | null;
|
|
23
|
+
/** With an error: whether the writer is newer than the reader (update the reader) or older (write the data again) */
|
|
24
|
+
newer: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function checkVersion(version: string, range: string, known: string): IVersionCheck;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as PIXI from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* A Pixi Transform whose rotation and skew follow createjs.
|
|
4
|
+
*
|
|
5
|
+
* - The createjs values (degrees) are kept as written, so that reading them
|
|
6
|
+
* back gives exactly what was written (a degrees -> radians -> degrees round
|
|
7
|
+
* trip does not)
|
|
8
|
+
* - Pixi's own fields carry the same values in Pixi's terms (rotation in
|
|
9
|
+
* radians, skew.x = -skewX, skew.y = skewY, all in radians), so code that
|
|
10
|
+
* uses the Pixi node sees consistent values. A write made through Pixi
|
|
11
|
+
* (node.rotation, node.skew) is taken over as the new createjs value
|
|
12
|
+
* - The local matrix is built the createjs way: skew x (rotation x scale),
|
|
13
|
+
* i.e. the object is rotated first and then skewed. Pixi composes rotation
|
|
14
|
+
* and skew the other way round (skewed, then rotated as a whole); the two
|
|
15
|
+
* agree only while the rotation is 0 or skewX equals skewY. Published
|
|
16
|
+
* content is the reference, so createjs's composition is used
|
|
17
|
+
*/
|
|
18
|
+
export declare class CjsTransform extends PIXI.Transform {
|
|
19
|
+
/** createjs rotation, in degrees */
|
|
20
|
+
degRotation: number;
|
|
21
|
+
/** createjs skewX / skewY, in degrees */
|
|
22
|
+
degSkewX: number;
|
|
23
|
+
degSkewY: number;
|
|
24
|
+
/** The radians last written to the Pixi fields for the values above */
|
|
25
|
+
private _radRotation;
|
|
26
|
+
private _radSkewX;
|
|
27
|
+
private _radSkewY;
|
|
28
|
+
setRotation(degrees: number): void;
|
|
29
|
+
setSkewX(degrees: number): void;
|
|
30
|
+
setSkewY(degrees: number): void;
|
|
31
|
+
protected updateSkew(): void;
|
|
32
|
+
}
|