Fix group VN mode with reduced motion

179153ae67219dcaa8c8f15a1bdb97ea5d19ccbe

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +15 -3Ignore whitespace
public/scripts/extensions/expressions/index.js+15 -3
@@ -285,6 +285,12 @@ async function visualNovelUpdateLayers(container) {
285 let images = Array.from($('#visual-novel-wrapper .expression-holder')).sort(sortFunction);285 let images = Array.from($('#visual-novel-wrapper .expression-holder')).sort(sortFunction);
286 let imagesWidth = [];286 let imagesWidth = [];
287287
288 for (const image of images) {
289 if (image instanceof HTMLImageElement && !image.complete) {
290 await new Promise(resolve => image.addEventListener('load', resolve, { once: true }));
291 }
292 }
293
288 images.forEach(image => {294 images.forEach(image => {
289 imagesWidth.push($(image).width());295 imagesWidth.push($(image).width());
290 });296 });
@@ -320,9 +326,15 @@ async function visualNovelUpdateLayers(container) {
320 element.show();326 element.show();
321327
322 const promise = new Promise(resolve => {328 const promise = new Promise(resolve => {
323 element.animate({ left: currentPosition + 'px' }, 500, () => {329 if (power_user.reduced_motion) {
324 resolve();330 element.css('left', currentPosition + 'px');
325 });331 requestAnimationFrame(() => resolve());
332 }
333 else {
334 element.animate({ left: currentPosition + 'px' }, 500, () => {
335 resolve();
336 });
337 }
326 });338 });
327339
328 currentPosition += imagesWidth[index];340 currentPosition += imagesWidth[index];