frigame3 3.0.0 → 3.0.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/dist/Animation.d.ts +42 -0
- package/dist/Animation.js +189 -0
- package/dist/BaseSprite.d.ts +116 -0
- package/dist/BaseSprite.js +518 -0
- package/dist/Gradient.d.ts +31 -0
- package/dist/Gradient.js +89 -0
- package/dist/Playground.d.ts +48 -0
- package/dist/Playground.js +167 -0
- package/dist/Rect.d.ts +63 -0
- package/dist/Rect.js +155 -0
- package/dist/Rectangle.d.ts +31 -0
- package/dist/Rectangle.js +69 -0
- package/dist/Renderer.d.ts +23 -0
- package/dist/Renderer.js +1 -0
- package/dist/ResourceManager.d.ts +21 -0
- package/dist/ResourceManager.js +100 -0
- package/dist/Sprite.d.ts +56 -0
- package/dist/Sprite.js +437 -0
- package/dist/SpriteGroup.d.ts +39 -0
- package/dist/SpriteGroup.js +176 -0
- package/dist/canvasRenderer/renderGroup.d.ts +15 -0
- package/dist/canvasRenderer/renderGroup.js +134 -0
- package/dist/canvasRenderer/renderPlayground.d.ts +9 -0
- package/dist/canvasRenderer/renderPlayground.js +67 -0
- package/dist/canvasRenderer/renderRectangle.d.ts +15 -0
- package/dist/canvasRenderer/renderRectangle.js +287 -0
- package/dist/canvasRenderer/renderSprite.d.ts +4 -0
- package/dist/canvasRenderer/renderSprite.js +93 -0
- package/dist/canvasRenderer.d.ts +2 -0
- package/dist/canvasRenderer.js +19 -0
- package/dist/dummyRenderer.d.ts +2 -0
- package/dist/dummyRenderer.js +41 -0
- package/dist/plugins/GamepadTracker.d.ts +15 -0
- package/dist/plugins/GamepadTracker.js +74 -0
- package/dist/plugins/Tilemap.d.ts +26 -0
- package/dist/plugins/Tilemap.js +85 -0
- package/dist/plugins/Vec2.d.ts +69 -0
- package/dist/plugins/Vec2.js +296 -0
- package/dist/plugins/fx/Shaker.d.ts +46 -0
- package/dist/plugins/fx/Shaker.js +190 -0
- package/dist/plugins/fx/Tweener.d.ts +42 -0
- package/dist/plugins/fx/Tweener.js +166 -0
- package/dist/plugins/fx/easing.d.ts +32 -0
- package/dist/plugins/fx/easing.js +192 -0
- package/dist/plugins/isometric/ISOMixin.d.ts +138 -0
- package/dist/plugins/isometric/ISOMixin.js +322 -0
- package/dist/plugins/isometric/ISORectangle.d.ts +151 -0
- package/dist/plugins/isometric/ISORectangle.js +127 -0
- package/dist/plugins/isometric/ISOSprite.d.ts +157 -0
- package/dist/plugins/isometric/ISOSprite.js +176 -0
- package/dist/plugins/isometric/ISOSpriteGroup.d.ts +151 -0
- package/dist/plugins/isometric/ISOSpriteGroup.js +116 -0
- package/dist/plugins/isometric/ISOTilemap.d.ts +24 -0
- package/dist/plugins/isometric/ISOTilemap.js +85 -0
- package/dist/plugins/isometric/utils.d.ts +2 -0
- package/dist/plugins/isometric/utils.js +10 -0
- package/dist/plugins/keyTracker.d.ts +3 -0
- package/dist/plugins/keyTracker.js +23 -0
- package/dist/plugins/mixer.d.ts +72 -0
- package/dist/plugins/mixer.js +396 -0
- package/dist/plugins/sorted/SortedAnimation.d.ts +13 -0
- package/dist/plugins/sorted/SortedAnimation.js +27 -0
- package/dist/plugins/sorted/SortedGroup.d.ts +137 -0
- package/dist/plugins/sorted/SortedGroup.js +61 -0
- package/dist/plugins/sorted/SortedMixin.d.ts +122 -0
- package/dist/plugins/sorted/SortedMixin.js +153 -0
- package/dist/plugins/sorted/SortedRectangle.d.ts +127 -0
- package/dist/plugins/sorted/SortedRectangle.js +17 -0
- package/dist/plugins/sorted/SortedSprite.d.ts +130 -0
- package/dist/plugins/sorted/SortedSprite.js +35 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +33 -0
- package/package.json +6 -2
- package/CHANGELOG.md +0 -13
- package/biome.json +0 -93
- package/demo/package-lock.json +0 -515
- package/demo/package.json +0 -19
- package/demo/snake/index.html +0 -16
- package/demo/snake/index.ts +0 -110
- package/demo/tetris/index.html +0 -16
- package/demo/tetris/index.ts +0 -536
- package/demo/tsconfig.json +0 -53
- package/src/Animation.ts +0 -266
- package/src/BaseSprite.ts +0 -682
- package/src/Gradient.ts +0 -120
- package/src/Playground.ts +0 -247
- package/src/Rect.ts +0 -237
- package/src/Rectangle.ts +0 -108
- package/src/Renderer.ts +0 -28
- package/src/ResourceManager.ts +0 -145
- package/src/Sprite.ts +0 -484
- package/src/SpriteGroup.ts +0 -258
- package/src/canvasRenderer/renderGroup.ts +0 -194
- package/src/canvasRenderer/renderPlayground.ts +0 -103
- package/src/canvasRenderer/renderRectangle.ts +0 -421
- package/src/canvasRenderer/renderSprite.ts +0 -148
- package/src/canvasRenderer.ts +0 -38
- package/src/dummyRenderer.ts +0 -62
- package/src/plugins/GamepadTracker.ts +0 -97
- package/src/plugins/Tilemap.ts +0 -123
- package/src/plugins/Vec2.ts +0 -420
- package/src/plugins/fx/Shaker.ts +0 -293
- package/src/plugins/fx/Tweener.ts +0 -252
- package/src/plugins/fx/easing.ts +0 -276
- package/src/plugins/isometric/ISOMixin.ts +0 -444
- package/src/plugins/isometric/ISORectangle.ts +0 -183
- package/src/plugins/isometric/ISOSprite.ts +0 -228
- package/src/plugins/isometric/ISOSpriteGroup.ts +0 -155
- package/src/plugins/isometric/ISOTilemap.ts +0 -122
- package/src/plugins/isometric/utils.ts +0 -19
- package/src/plugins/keyTracker.ts +0 -31
- package/src/plugins/mixer.ts +0 -523
- package/src/plugins/sorted/SortedAnimation.ts +0 -53
- package/src/plugins/sorted/SortedGroup.ts +0 -94
- package/src/plugins/sorted/SortedMixin.ts +0 -203
- package/src/plugins/sorted/SortedRectangle.ts +0 -35
- package/src/plugins/sorted/SortedSprite.ts +0 -56
- package/src/utils.ts +0 -53
- package/test/animation/index.html +0 -20
- package/test/animation/index.ts +0 -253
- package/test/animation/mh.png +0 -0
- package/test/animation/moh.png +0 -0
- package/test/animation/mov.png +0 -0
- package/test/animation/mv.png +0 -0
- package/test/animation/rebound.png +0 -0
- package/test/animation/reboundm.png +0 -0
- package/test/animation/sh.png +0 -0
- package/test/animation/soh.png +0 -0
- package/test/animation/sov.png +0 -0
- package/test/animation/sv.png +0 -0
- package/test/isometric1/beach.png +0 -0
- package/test/isometric1/foglie.png +0 -0
- package/test/isometric1/grass.png +0 -0
- package/test/isometric1/index.html +0 -17
- package/test/isometric1/index.ts +0 -68
- package/test/isometric1/tronco.png +0 -0
- package/test/isometric1/untitled.tmx +0 -25
- package/test/isometric1/water.png +0 -0
- package/test/isometric2/banner.png +0 -0
- package/test/isometric2/books.png +0 -0
- package/test/isometric2/candlestick.png +0 -0
- package/test/isometric2/ice.png +0 -0
- package/test/isometric2/index.html +0 -16
- package/test/isometric2/index.ts +0 -129
- package/test/isometric2/knight_se.png +0 -0
- package/test/isometric2/tile.png +0 -0
- package/test/isometric2/untitled.tmx +0 -36
- package/test/isometric2/wall.png +0 -0
- package/test/layers/boy.png +0 -0
- package/test/layers/catgirl.png +0 -0
- package/test/layers/fri1.svg +0 -8
- package/test/layers/grassblock.png +0 -0
- package/test/layers/horngirl.png +0 -0
- package/test/layers/index.html +0 -17
- package/test/layers/index.ts +0 -191
- package/test/layers/pinkgirl.png +0 -0
- package/test/layers/render_ruler.py +0 -57
- package/test/layers/ruler.png +0 -0
- package/test/layers/sh.png +0 -0
- package/test/mixer/dieci.opus +0 -0
- package/test/mixer/dieci.wav +0 -0
- package/test/mixer/index.html +0 -33
- package/test/mixer/index.ts +0 -206
- package/test/mixer/news_intro.mp3 +0 -0
- package/test/mixer/news_intro.ogg +0 -0
- package/test/mixer/prova.mp3 +0 -0
- package/test/mixer/prova.ogg +0 -0
- package/test/package-lock.json +0 -515
- package/test/package.json +0 -19
- package/test/sorted/Brown Block.png +0 -0
- package/test/sorted/index.html +0 -16
- package/test/sorted/index.ts +0 -38
- package/test/transformation1/index.html +0 -17
- package/test/transformation1/index.ts +0 -51
- package/test/transformation1/sh.png +0 -0
- package/test/transformation2/index.html +0 -20
- package/test/transformation2/index.ts +0 -71
- package/test/transformation2/sh.png +0 -0
- package/test/tsconfig.json +0 -53
- package/tsconfig.json +0 -51
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { SpriteGroup } from "../../SpriteGroup.js";
|
|
2
|
+
import { pick } from "../../utils.js";
|
|
3
|
+
import { SortedGroup } from "../sorted/SortedGroup.js";
|
|
4
|
+
import { ISO } from "./ISOMixin.js";
|
|
5
|
+
const ISOBaseGroup = ISO(SpriteGroup);
|
|
6
|
+
export class ISOSpriteGroup extends ISOBaseGroup {
|
|
7
|
+
_originx = 0;
|
|
8
|
+
_originy = 0;
|
|
9
|
+
_referencex = 0;
|
|
10
|
+
_referencey = 0;
|
|
11
|
+
_screen_obj = null;
|
|
12
|
+
// Proxy getters & setters
|
|
13
|
+
get crop() {
|
|
14
|
+
return super.crop;
|
|
15
|
+
}
|
|
16
|
+
set crop(value) {
|
|
17
|
+
super.crop = value;
|
|
18
|
+
if (this._screen_obj !== null) {
|
|
19
|
+
this._screen_obj.crop = value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
get borderRadius() {
|
|
23
|
+
return super.borderRadius;
|
|
24
|
+
}
|
|
25
|
+
set borderRadius(value) {
|
|
26
|
+
super.borderRadius = value;
|
|
27
|
+
if (this._screen_obj !== null) {
|
|
28
|
+
this._screen_obj.borderRadius = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
constructor(options) {
|
|
32
|
+
super();
|
|
33
|
+
if (options !== undefined) {
|
|
34
|
+
Object.assign(this, pick(options, [
|
|
35
|
+
"left",
|
|
36
|
+
"right",
|
|
37
|
+
"centerx",
|
|
38
|
+
"top",
|
|
39
|
+
"bottom",
|
|
40
|
+
"centery",
|
|
41
|
+
"width",
|
|
42
|
+
"halfWidth",
|
|
43
|
+
"height",
|
|
44
|
+
"halfHeight",
|
|
45
|
+
"radius",
|
|
46
|
+
"transformOrigin",
|
|
47
|
+
"transformOriginx",
|
|
48
|
+
"transformOriginy",
|
|
49
|
+
"angle",
|
|
50
|
+
"scale",
|
|
51
|
+
"scalex",
|
|
52
|
+
"scaley",
|
|
53
|
+
"flip",
|
|
54
|
+
"fliph",
|
|
55
|
+
"flipv",
|
|
56
|
+
"opacity",
|
|
57
|
+
"hidden",
|
|
58
|
+
"blendMode",
|
|
59
|
+
"crop",
|
|
60
|
+
"borderRadius",
|
|
61
|
+
"originx",
|
|
62
|
+
"originy",
|
|
63
|
+
"referencex",
|
|
64
|
+
"referencey",
|
|
65
|
+
"elevation",
|
|
66
|
+
]));
|
|
67
|
+
if (options.children !== undefined) {
|
|
68
|
+
this.addChildren(options.children);
|
|
69
|
+
}
|
|
70
|
+
if (options.ref !== undefined) {
|
|
71
|
+
options.ref.current = this;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this._move(null, 0);
|
|
75
|
+
this.teleport();
|
|
76
|
+
}
|
|
77
|
+
// Implementation details
|
|
78
|
+
_resize(prop, value) {
|
|
79
|
+
// TODO: I'm not sure that proxying the new size is the right approach here,
|
|
80
|
+
// as the screen object is merely a graphical representation of a projection.
|
|
81
|
+
// In theory the size of any ISO should be independent of the size of its
|
|
82
|
+
// screen object.
|
|
83
|
+
super._resize(prop, value);
|
|
84
|
+
this._screen_obj?._resize(prop, value);
|
|
85
|
+
}
|
|
86
|
+
_onReparent() {
|
|
87
|
+
// The screen sprite group must be created in the screen layer
|
|
88
|
+
const parent = this.parent;
|
|
89
|
+
const parent_screen_obj = "_screen_obj" in parent ? parent._screen_obj : parent;
|
|
90
|
+
// TODO: Is the newly created screen object in the correct drawing order?
|
|
91
|
+
this._screen_obj = parent_screen_obj.addChild(new SortedGroup({
|
|
92
|
+
width: this.width,
|
|
93
|
+
height: this.height,
|
|
94
|
+
transformOriginx: this.transformOriginx,
|
|
95
|
+
transformOriginy: this.transformOriginy,
|
|
96
|
+
angle: this.angle,
|
|
97
|
+
scalex: this.scalex,
|
|
98
|
+
scaley: this.scaley,
|
|
99
|
+
fliph: this.fliph,
|
|
100
|
+
flipv: this.flipv,
|
|
101
|
+
opacity: this.opacity,
|
|
102
|
+
hidden: this.hidden,
|
|
103
|
+
blendMode: this.blendMode,
|
|
104
|
+
crop: this.crop,
|
|
105
|
+
borderRadius: this.borderRadius,
|
|
106
|
+
originx: this.originx,
|
|
107
|
+
originy: this.originy,
|
|
108
|
+
}));
|
|
109
|
+
this._move("elevation", this.elevation);
|
|
110
|
+
this.teleport();
|
|
111
|
+
}
|
|
112
|
+
_remove() {
|
|
113
|
+
super._remove();
|
|
114
|
+
this.clear();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BaseSprite } from "../../BaseSprite.js";
|
|
2
|
+
import type { SpriteRef } from "../../utils.js";
|
|
3
|
+
import type { ISORectangleOptions } from "./ISORectangle.js";
|
|
4
|
+
import type { ISOSpriteOptions } from "./ISOSprite.js";
|
|
5
|
+
import type { ISOGroupOptions } from "./ISOSpriteGroup.js";
|
|
6
|
+
import { ISOSpriteGroup } from "./ISOSpriteGroup.js";
|
|
7
|
+
export type ISOTileOptions = (Pick<ISOSpriteOptions, "animation"> & Partial<ISOSpriteOptions>) | (Pick<ISORectangleOptions, "background"> & Partial<ISORectangleOptions>);
|
|
8
|
+
export interface ISOTilemapOptions {
|
|
9
|
+
sizex: number;
|
|
10
|
+
sizey: number;
|
|
11
|
+
tileSize: number;
|
|
12
|
+
data: number[];
|
|
13
|
+
animationList: Record<number, ISOTileOptions>;
|
|
14
|
+
}
|
|
15
|
+
export declare class ISOTilemap extends ISOSpriteGroup {
|
|
16
|
+
sizex: number;
|
|
17
|
+
sizey: number;
|
|
18
|
+
tileSize: number;
|
|
19
|
+
_locations: Uint32Array;
|
|
20
|
+
constructor(options: ISOTilemapOptions & Partial<ISOGroupOptions> & {
|
|
21
|
+
ref?: SpriteRef<ISOTilemap>;
|
|
22
|
+
});
|
|
23
|
+
getAt(row: number, col: number): BaseSprite | undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ISORectangle } from "./ISORectangle.js";
|
|
2
|
+
import { ISOSprite } from "./ISOSprite.js";
|
|
3
|
+
import { ISOSpriteGroup } from "./ISOSpriteGroup.js";
|
|
4
|
+
export class ISOTilemap extends ISOSpriteGroup {
|
|
5
|
+
sizex = 0;
|
|
6
|
+
sizey = 0;
|
|
7
|
+
tileSize = 0;
|
|
8
|
+
_locations;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super(options);
|
|
11
|
+
const { sizex, sizey, tileSize } = options;
|
|
12
|
+
this.sizex = sizex;
|
|
13
|
+
this.sizey = sizey;
|
|
14
|
+
this.tileSize = tileSize;
|
|
15
|
+
const locations = new Uint32Array(sizex * sizey).fill(0xffffffff);
|
|
16
|
+
this._locations = locations;
|
|
17
|
+
const layers = this._layers;
|
|
18
|
+
if (options.width === undefined &&
|
|
19
|
+
options.halfWidth === undefined &&
|
|
20
|
+
options.radius === undefined) {
|
|
21
|
+
this.width = sizex * tileSize;
|
|
22
|
+
}
|
|
23
|
+
if (options.height === undefined &&
|
|
24
|
+
options.halfHeight === undefined &&
|
|
25
|
+
options.radius === undefined) {
|
|
26
|
+
this.height = sizey * tileSize;
|
|
27
|
+
}
|
|
28
|
+
const animationList = options.animationList;
|
|
29
|
+
let i_location = 0;
|
|
30
|
+
let row = 0;
|
|
31
|
+
let col = 0;
|
|
32
|
+
let left = 0;
|
|
33
|
+
let top = 0;
|
|
34
|
+
for (const data of options.data) {
|
|
35
|
+
const animation_options = animationList[data];
|
|
36
|
+
if (animation_options !== undefined && "animation" in animation_options) {
|
|
37
|
+
// Sprite
|
|
38
|
+
const sprite_options = Object.assign({}, animation_options, {
|
|
39
|
+
left,
|
|
40
|
+
top,
|
|
41
|
+
width: tileSize,
|
|
42
|
+
height: tileSize,
|
|
43
|
+
});
|
|
44
|
+
this.addChild(new ISOSprite(sprite_options));
|
|
45
|
+
locations[i_location] = layers.length - 1;
|
|
46
|
+
}
|
|
47
|
+
else if (animation_options !== undefined &&
|
|
48
|
+
"background" in animation_options) {
|
|
49
|
+
// Rectangle
|
|
50
|
+
const rectangle_options = Object.assign({}, animation_options, {
|
|
51
|
+
left,
|
|
52
|
+
top,
|
|
53
|
+
width: tileSize,
|
|
54
|
+
height: tileSize,
|
|
55
|
+
});
|
|
56
|
+
this.addChild(new ISORectangle(rectangle_options));
|
|
57
|
+
locations[i_location] = layers.length - 1;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// TODO: Invalid
|
|
61
|
+
}
|
|
62
|
+
i_location += 1;
|
|
63
|
+
left += tileSize;
|
|
64
|
+
col += 1;
|
|
65
|
+
if (col >= sizex) {
|
|
66
|
+
col = 0;
|
|
67
|
+
left = 0;
|
|
68
|
+
row += 1;
|
|
69
|
+
top += tileSize;
|
|
70
|
+
if (row >= sizey) {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
getAt(row, col) {
|
|
77
|
+
const i = row * this.sizex + col;
|
|
78
|
+
if (i < this._locations.length) {
|
|
79
|
+
return this._layers[this._locations[i]];
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function screenFromGrid(grid_x, grid_y) {
|
|
2
|
+
const screen_x = grid_x - grid_y;
|
|
3
|
+
const screen_y = (grid_x + grid_y) / 2;
|
|
4
|
+
return [screen_x, screen_y];
|
|
5
|
+
}
|
|
6
|
+
export function gridFromScreen(screen_x, screen_y) {
|
|
7
|
+
const grid_x = screen_y + screen_x / 2;
|
|
8
|
+
const grid_y = screen_y - screen_x / 2;
|
|
9
|
+
return [grid_x, grid_y];
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
let started = false;
|
|
2
|
+
export const keyTracker = {};
|
|
3
|
+
function onKeydown(e) {
|
|
4
|
+
keyTracker[e.code] = true;
|
|
5
|
+
}
|
|
6
|
+
function onKeyup(e) {
|
|
7
|
+
keyTracker[e.code] = false;
|
|
8
|
+
}
|
|
9
|
+
export function startKeyTracker() {
|
|
10
|
+
if (!started) {
|
|
11
|
+
document.addEventListener("keydown", onKeydown);
|
|
12
|
+
document.addEventListener("keyup", onKeyup);
|
|
13
|
+
started = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function stopKeyTracker() {
|
|
17
|
+
if (started) {
|
|
18
|
+
document.removeEventListener("keydown", onKeydown);
|
|
19
|
+
document.removeEventListener("keyup", onKeyup);
|
|
20
|
+
started = false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
startKeyTracker();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Resource } from "../ResourceManager.js";
|
|
2
|
+
export interface ChannelOptions {
|
|
3
|
+
muted: boolean;
|
|
4
|
+
volume: number;
|
|
5
|
+
panning: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SingleChannelPlayOptions {
|
|
8
|
+
loop: boolean;
|
|
9
|
+
callback: () => void;
|
|
10
|
+
playbackRate: number;
|
|
11
|
+
}
|
|
12
|
+
export interface MultiChannelPlayOptions {
|
|
13
|
+
callback: () => void;
|
|
14
|
+
playbackRate: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const canPlay: {
|
|
17
|
+
opus: boolean;
|
|
18
|
+
ogg: boolean;
|
|
19
|
+
mp3: boolean;
|
|
20
|
+
m4a: boolean;
|
|
21
|
+
wav: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const _audioCtx: AudioContext;
|
|
24
|
+
export declare class Sound implements Resource {
|
|
25
|
+
soundURL: string;
|
|
26
|
+
streaming: boolean;
|
|
27
|
+
_initialized: boolean;
|
|
28
|
+
_audio: HTMLAudioElement | null;
|
|
29
|
+
_source: MediaElementAudioSourceNode | null;
|
|
30
|
+
_audioBuffer: AudioBuffer | null;
|
|
31
|
+
_waitAudioBuffer: boolean;
|
|
32
|
+
constructor(soundURLs: string | string[] | Partial<Record<keyof typeof canPlay, string>>, options?: {
|
|
33
|
+
streaming: boolean;
|
|
34
|
+
});
|
|
35
|
+
complete(): boolean;
|
|
36
|
+
onLoad(): void;
|
|
37
|
+
}
|
|
38
|
+
declare class Channel {
|
|
39
|
+
_muted: boolean;
|
|
40
|
+
_volume: number;
|
|
41
|
+
_panning: number;
|
|
42
|
+
_panner: StereoPannerNode;
|
|
43
|
+
_gainNode: GainNode;
|
|
44
|
+
get muted(): boolean;
|
|
45
|
+
set muted(value: boolean);
|
|
46
|
+
get volume(): number;
|
|
47
|
+
set volume(value: number);
|
|
48
|
+
get panning(): number;
|
|
49
|
+
set panning(value: number);
|
|
50
|
+
constructor(options?: Partial<ChannelOptions>);
|
|
51
|
+
}
|
|
52
|
+
export declare class SingleChannel extends Channel {
|
|
53
|
+
_sound: Sound | null;
|
|
54
|
+
_source: AudioNode | null;
|
|
55
|
+
_playbackRate: number;
|
|
56
|
+
_startTime: number;
|
|
57
|
+
_pauseTime: number;
|
|
58
|
+
_old_loop: boolean;
|
|
59
|
+
_old_onended: (() => void) | null;
|
|
60
|
+
get sound(): Sound | null;
|
|
61
|
+
get playbackRate(): number;
|
|
62
|
+
set playbackRate(value: number);
|
|
63
|
+
play(sound: Sound, options?: Partial<SingleChannelPlayOptions>): this;
|
|
64
|
+
stop(): this;
|
|
65
|
+
pause(): this;
|
|
66
|
+
resume(): this;
|
|
67
|
+
_disconnect: () => void;
|
|
68
|
+
}
|
|
69
|
+
export declare class MultiChannel extends Channel {
|
|
70
|
+
play(sound: Sound, options?: Partial<MultiChannelPlayOptions>): this;
|
|
71
|
+
}
|
|
72
|
+
export {};
|