mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 18:39:45 +00:00
Update comments for LottieViewer and clarify usage
This commit is contained in:
@@ -1,18 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* SvgaViewer: Provides SVGA animation preview with the following features.
|
* LottieViewer: Provides Lottie animation preview with the following features.
|
||||||
*
|
*
|
||||||
* Requirements:
|
* Requirements:
|
||||||
* - Requires the following HTML structure:
|
* - Requires the following HTML structure:
|
||||||
* <canvas id="canvas">
|
* <div id="bm"></div>
|
||||||
* </canvas>
|
* - Lottie file path is obtained via chrome.webview.hostObjects.external.GetPath()
|
||||||
* - SVGA file path is obtained via chrome.webview.hostObjects.external.GetPath()
|
|
||||||
*
|
*
|
||||||
* Features:
|
* Features:
|
||||||
* - Loads and plays SVGA animation files
|
* - Loads and plays Lottie animation files
|
||||||
* - Uses SVGA.js library for parsing and playback
|
* - Uses lottie-web library for parsing and playback
|
||||||
* - Automatically starts playback after loading
|
* - Automatically starts playback after loading
|
||||||
* - Handles asynchronous loading and mounting of SVGA files
|
* - Handles asynchronous loading and mounting of Lottie files
|
||||||
*/
|
*/
|
||||||
class LottieViewer {
|
class LottieViewer {
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
@@ -23,6 +22,8 @@ class LottieViewer {
|
|||||||
*/
|
*/
|
||||||
async play() {
|
async play() {
|
||||||
const path = await chrome.webview.hostObjects.external.GetPath();
|
const path = await chrome.webview.hostObjects.external.GetPath();
|
||||||
|
|
||||||
|
// Because the path is a local file, we need to convert it to a URL format
|
||||||
lottie.loadAnimation({
|
lottie.loadAnimation({
|
||||||
container: document.getElementById('bm'),
|
container: document.getElementById('bm'),
|
||||||
renderer: 'svg',
|
renderer: 'svg',
|
||||||
|
Reference in New Issue
Block a user