From 47afc183f4a3efdceada805b30527f6c1b46b572 Mon Sep 17 00:00:00 2001 From: Haoyu Xu Date: Fri, 23 Jun 2023 09:32:04 -0400 Subject: [PATCH] feat(showcase): add ability to disable start animation --- src/components/player.js | 4 ++-- src/components/settings.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/player.js b/src/components/player.js index 938f0b4..d7b07dd 100644 --- a/src/components/player.js +++ b/src/components/player.js @@ -30,10 +30,10 @@ export default function spinePlayer(el) { fps: 60, defaultMix: 0, success: function (widget) { - if (widget.skeleton.data.animations.map(e => e.name).includes("Start")) { + if (widget.skeleton.data.animations.map(e => e.name).includes("Start") && window.settings.useStartAnimation) { widget.animationState.setAnimation(0, "Start", false, 0) - widget.animationState.addAnimation(0, "Idle", true, 0); } + widget.animationState.addAnimation(0, "Idle", true, 0); widget.animationState.addListener({ end: (e) => { if (e.animation.name == "Interact") { diff --git a/src/components/settings.js b/src/components/settings.js index 10592fb..00a0e4a 100644 --- a/src/components/settings.js +++ b/src/components/settings.js @@ -40,6 +40,7 @@ export default class Settings { #isInsightsInited = false #doNotTrack = false #lastFunctionInsights = null + #useStartAnimation = true constructor(el, logoEl) { this.isWallpaperEngine = false @@ -283,6 +284,14 @@ export default class Settings { document.getElementById("logo_padding_y_input").value = this.#defaultLogoY } + set useStartAnimation(v) { + this.#useStartAnimation = v + } + + get useStartAnimation() { + return this.#useStartAnimation + } + open() { this.#el.hidden = false; } @@ -459,6 +468,10 @@ export default class Settings { +
+ + +
@@ -717,6 +730,10 @@ export default class Settings { this.spinePlayer.animationState.setAnimation(0, e.currentTarget.value, false, 0) this.spinePlayer.animationState.addAnimation(0, "Idle", true, 0); } + }, { + id: "use_start_animation", event: "click", handler: e => { + this.#useStartAnimation = e.currentTarget.checked; + } }, ]