@code-dot-org/dance-party
Advanced tools
Comparing version 1.0.15 to 1.1.0
{ | ||
"name": "@code-dot-org/dance-party", | ||
"version": "1.0.15", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -151,2 +151,3 @@ /* eslint-disable no-unused-vars, curly, eqeqeq */ | ||
this.loopAnalysisEvents = false; | ||
this.livePreviewStopTime = 0; | ||
@@ -331,2 +332,3 @@ new P5(p5Inst => { | ||
this.loopAnalysisEvents = false; | ||
this.livePreviewStopTime = 0; | ||
} | ||
@@ -373,3 +375,10 @@ | ||
livePreview(songData) { | ||
/** | ||
* Starts a live preview of the animation only (no audio). | ||
* | ||
* @param {Object} songData - song metadata for the preview | ||
* @param {number | undefined} durationMs - (optional) duration to run the preview for in milliseconds. | ||
* If no duration is provided, the preview will run continuously until reset() is called | ||
*/ | ||
livePreview(songData, durationMs) { | ||
this.songMetadata_ = modifySongData(songData); | ||
@@ -379,2 +388,3 @@ this.analysisPosition_ = 0; | ||
this.loopAnalysisEvents = true; | ||
this.livePreviewStopTime = durationMs === undefined ? 0 : Date.now() + durationMs; | ||
this.p5_.loop(); | ||
@@ -1577,2 +1587,7 @@ } | ||
} | ||
// Stop live preview animation if necessary. | ||
if (this.livePreviewStopTime && Date.now() > this.livePreviewStopTime) { | ||
this.p5_.noLoop(); | ||
} | ||
} | ||
@@ -1579,0 +1594,0 @@ }; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20940433
113980