VR overlay progress bar

This commit is contained in:
Natsumi
2021-09-29 12:45:40 +13:00
parent 9fb0a58e20
commit 6e312a71f7
5 changed files with 38 additions and 14 deletions

View File

@@ -13,8 +13,6 @@ Vue.component('marquee-text', MarqueeText);
import configRepository from './repository/config.js';
speechSynthesis.getVoices();
(async function () {
var $app = null;
@@ -293,6 +291,16 @@ speechSynthesis.getVoices();
$app.methods.nowPlayingUpdate = function (json) {
this.nowPlaying = JSON.parse(json);
if (this.appType === '2') {
var circle = document.querySelector(".np-progress-circle-stroke");
if (this.config.progressPie && this.nowPlaying.percentage !== 0) {
circle.style.opacity = 0.5;
var circumference = circle.getTotalLength();
circle.style.strokeDashoffset = circumference - (this.nowPlaying.percentage / 100) * circumference;
} else {
circle.style.opacity = 0;
}
}
};
$app.methods.lastLocationUpdate = function (json) {
@@ -480,15 +488,6 @@ speechSynthesis.getVoices();
return text;
};
$app.methods.speak = function (text) {
var tts = new SpeechSynthesisUtterance();
var voices = speechSynthesis.getVoices();
var voiceIndex = this.config.notificationTTSVoice;
tts.voice = voices[voiceIndex];
tts.text = text;
speechSynthesis.speak(tts);
};
$app = new Vue($app);
window.$app = $app;
})();