From 79780e3c6a0b0e7449cfb4307f76b426e20f4857 Mon Sep 17 00:00:00 2001 From: itorr Date: Fri, 26 Aug 2022 03:59:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E9=98=BB=E5=B0=BC=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=20#11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + html/document.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aa5b06e..776065e 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ - 添加 `?v=takina` 请求参数,可获得 [井上泷奈](https://lab.magiconch.com/sakana/?v=takina) 专属链接 - 添加 `?alpha=true` 请求参数,可获得透明背景 [例](https://lab.magiconch.com/sakana/?alpha=true) - 添加 `?background=red` 请求参数,可自定义背景 `red` `#FF00FF` `'#d77 url(chisato.png)'` 均可 [例](https://lab.magiconch.com/sakana/?background=%23d77%20url(chisato.png)) + - 添加 `?decay=1` 请求参数,无阻尼永续模式 [#11](https://github.com/itorr/sakana/issues/11) ## 本地调试 `document.less` 需要编译成 `.css` 样式文件 [#6](https://github.com/itorr/sakana/pull/6) diff --git a/html/document.js b/html/document.js index e12ddd5..40a4084 100644 --- a/html/document.js +++ b/html/document.js @@ -31,7 +31,7 @@ if(params.alpha){ // 自定义背景色 if(params.background){ - htmlEl.setAttribute('data-alpha',params.alpha); + htmlEl.setAttribute('data-alpha',true); htmlEl.style.background = params.background; } @@ -54,6 +54,15 @@ const Values = { }; +// 自定义衰减 +if(params.decay){ + let decay = +params.decay; + for(let key in Values){ + Values[key].d = decay; + } +} + + const voiceButton = document.querySelector('.set-voice'); const Voices = {