@pixerate/editor 0.264.0 → 0.264.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.
|
@@ -1422,7 +1422,7 @@ export declare class PaintEditorController {
|
|
|
1422
1422
|
strokes: number;
|
|
1423
1423
|
sources: number;
|
|
1424
1424
|
} | null;
|
|
1425
|
-
/** Plays or pauses live effect paint, and caps its frame rate (1..60). Editor state, not an undo step. */
|
|
1425
|
+
/** Plays or pauses live effect paint, and caps its frame rate (1..60); a setting left out keeps its value. Editor state, not an undo step. */
|
|
1426
1426
|
setEffectPlayback(update: {
|
|
1427
1427
|
playing?: boolean;
|
|
1428
1428
|
fps?: number;
|
|
@@ -1422,7 +1422,7 @@ export declare class PaintEditorController {
|
|
|
1422
1422
|
strokes: number;
|
|
1423
1423
|
sources: number;
|
|
1424
1424
|
} | null;
|
|
1425
|
-
/** Plays or pauses live effect paint, and caps its frame rate (1..60). Editor state, not an undo step. */
|
|
1425
|
+
/** Plays or pauses live effect paint, and caps its frame rate (1..60); a setting left out keeps its value. Editor state, not an undo step. */
|
|
1426
1426
|
setEffectPlayback(update: {
|
|
1427
1427
|
playing?: boolean;
|
|
1428
1428
|
fps?: number;
|
|
@@ -5579,7 +5579,8 @@ async function replayPainting(source, target, options = {}) {
|
|
|
5579
5579
|
const maxStrokes = _nullishCoalesce(options.strokes, () => ( source.strokes.length));
|
|
5580
5580
|
const chunk = Math.max(1, _nullishCoalesce(options.wetChunk, () => ( 0))) || Infinity;
|
|
5581
5581
|
let strokes = 0;
|
|
5582
|
-
|
|
5582
|
+
const scaled = source.strokes.slice(0, maxStrokes).map((st) => s === 1 ? st : varyStroke(st, scaleM, { scale: s }));
|
|
5583
|
+
await target.prepareEffectPaints(scaled.flatMap((st) => _optionalChain([st, 'access', _247 => _247.paint, 'optionalAccess', _248 => _248.type]) === "effect" ? [st.paint] : []));
|
|
5583
5584
|
const advanceTo = async (clock) => {
|
|
5584
5585
|
const now = target.getState().wet.clock;
|
|
5585
5586
|
let left = clock - now;
|
|
@@ -9588,11 +9589,11 @@ var PaintEditorController = (_class19 = class _PaintEditorController {
|
|
|
9588
9589
|
if (!layers.length) return null;
|
|
9589
9590
|
return { layerIds: layers.map((x) => x.layer.id), strokes: layers.reduce((n, x) => n + x.strokes.filter(isLiveEffect).length, 0), sources: sources.length };
|
|
9590
9591
|
}
|
|
9591
|
-
/** Plays or pauses live effect paint, and caps its frame rate (1..60). Editor state, not an undo step. */
|
|
9592
|
+
/** Plays or pauses live effect paint, and caps its frame rate (1..60); a setting left out keeps its value. Editor state, not an undo step. */
|
|
9592
9593
|
setEffectPlayback(update) {
|
|
9593
9594
|
if (update.playing !== void 0 && typeof update.playing !== "boolean") throw new PaintEditorError("playing must be true or false.");
|
|
9594
9595
|
if (update.fps !== void 0 && !(Number.isInteger(update.fps) && update.fps >= 1 && update.fps <= 60)) throw new PaintEditorError(`fps ${update.fps} is out of range; use a whole number 1..60.`);
|
|
9595
|
-
this.effectPlaybackState = {
|
|
9596
|
+
this.effectPlaybackState = { playing: _nullishCoalesce(update.playing, () => ( this.effectPlaybackState.playing)), fps: _nullishCoalesce(update.fps, () => ( this.effectPlaybackState.fps)) };
|
|
9596
9597
|
this.emit([]);
|
|
9597
9598
|
return { ...this.effectPlaybackState, time: this.effectTime };
|
|
9598
9599
|
}
|
|
@@ -5579,7 +5579,8 @@ async function replayPainting(source, target, options = {}) {
|
|
|
5579
5579
|
const maxStrokes = options.strokes ?? source.strokes.length;
|
|
5580
5580
|
const chunk = Math.max(1, options.wetChunk ?? 0) || Infinity;
|
|
5581
5581
|
let strokes = 0;
|
|
5582
|
-
|
|
5582
|
+
const scaled = source.strokes.slice(0, maxStrokes).map((st) => s === 1 ? st : varyStroke(st, scaleM, { scale: s }));
|
|
5583
|
+
await target.prepareEffectPaints(scaled.flatMap((st) => st.paint?.type === "effect" ? [st.paint] : []));
|
|
5583
5584
|
const advanceTo = async (clock) => {
|
|
5584
5585
|
const now = target.getState().wet.clock;
|
|
5585
5586
|
let left = clock - now;
|
|
@@ -9588,11 +9589,11 @@ var PaintEditorController = class _PaintEditorController {
|
|
|
9588
9589
|
if (!layers.length) return null;
|
|
9589
9590
|
return { layerIds: layers.map((x) => x.layer.id), strokes: layers.reduce((n, x) => n + x.strokes.filter(isLiveEffect).length, 0), sources: sources.length };
|
|
9590
9591
|
}
|
|
9591
|
-
/** Plays or pauses live effect paint, and caps its frame rate (1..60). Editor state, not an undo step. */
|
|
9592
|
+
/** Plays or pauses live effect paint, and caps its frame rate (1..60); a setting left out keeps its value. Editor state, not an undo step. */
|
|
9592
9593
|
setEffectPlayback(update) {
|
|
9593
9594
|
if (update.playing !== void 0 && typeof update.playing !== "boolean") throw new PaintEditorError("playing must be true or false.");
|
|
9594
9595
|
if (update.fps !== void 0 && !(Number.isInteger(update.fps) && update.fps >= 1 && update.fps <= 60)) throw new PaintEditorError(`fps ${update.fps} is out of range; use a whole number 1..60.`);
|
|
9595
|
-
this.effectPlaybackState = {
|
|
9596
|
+
this.effectPlaybackState = { playing: update.playing ?? this.effectPlaybackState.playing, fps: update.fps ?? this.effectPlaybackState.fps };
|
|
9596
9597
|
this.emit([]);
|
|
9597
9598
|
return { ...this.effectPlaybackState, time: this.effectTime };
|
|
9598
9599
|
}
|