Enhance carousel transitions with customizable duration and an option to disable fade for the slide effect.

This commit is contained in:
CPTN Cosmo 2026-01-24 15:41:04 +01:00
parent bf1f956f2b
commit 43a7ef4f54
No known key found for this signature in database
4 changed files with 51 additions and 6 deletions

View file

@ -45,6 +45,10 @@
"CarouselSpeedHint": "Sekunden, die jede Karte angezeigt wird, bevor gewechselt wird.", "CarouselSpeedHint": "Sekunden, die jede Karte angezeigt wird, bevor gewechselt wird.",
"CarouselEffect": "Übergangseffekt", "CarouselEffect": "Übergangseffekt",
"CarouselEffectHint": "Animationseffekt beim Wechseln der Karten.", "CarouselEffectHint": "Animationseffekt beim Wechseln der Karten.",
"CarouselDisableFade": "Verblassen für Slide-Effekt deaktivieren",
"CarouselDisableFadeHint": "Wenn aktiviert und der 'Gleiten' Effekt gewählt ist, bleiben die Karten während des Übergangs voll sichtbar (Klassisches Karussell).",
"CarouselTransitionDuration": "Übergangsdauer (ms)",
"CarouselTransitionDurationHint": "Wie lange die Animation dauert (Standard: 800ms).",
"CarouselGMMode": "GM Karussell-Verhalten", "CarouselGMMode": "GM Karussell-Verhalten",
"CarouselGMModeHint": "Wie der GM im Karussell dargestellt werden soll.", "CarouselGMModeHint": "Wie der GM im Karussell dargestellt werden soll.",
"CarouselHidePlayers": "Spieler im Karussell verbergen", "CarouselHidePlayers": "Spieler im Karussell verbergen",

View file

@ -53,6 +53,10 @@
"CarouselSpeedHint": "Seconds to show each player card before switching.", "CarouselSpeedHint": "Seconds to show each player card before switching.",
"CarouselEffect": "Transition Effect", "CarouselEffect": "Transition Effect",
"CarouselEffectHint": "Animation effect when switching cards.", "CarouselEffectHint": "Animation effect when switching cards.",
"CarouselDisableFade": "Disable Fade for Slide Effect",
"CarouselDisableFadeHint": "If enabled and using 'Slide' effect, cards will maintain full opacity during transition (Classic Carousel).",
"CarouselTransitionDuration": "Transition Duration (ms)",
"CarouselTransitionDurationHint": "How long the animation takes (Default: 800ms).",
"CarouselGMMode": "GM Carousel Behavior", "CarouselGMMode": "GM Carousel Behavior",
"CarouselGMModeHint": "How the GM should constitute in the carousel.", "CarouselGMModeHint": "How the GM should constitute in the carousel.",
"CarouselHidePlayers": "Hide Players in Carousel", "CarouselHidePlayers": "Hide Players in Carousel",

View file

@ -1,7 +1,7 @@
{ {
"id": "dh-stream-overlay", "id": "dh-stream-overlay",
"title": "Daggerheart Stream Overlay", "title": "Daggerheart Stream Overlay",
"version": "2.0.1", "version": "2.1.0",
"compatibility": { "compatibility": {
"minimum": "13", "minimum": "13",
"verified": "13" "verified": "13"
@ -45,6 +45,6 @@
"packFolders": [], "packFolders": [],
"url": "https://github.com/cptn-cosmo/dh-stream-overlay", "url": "https://github.com/cptn-cosmo/dh-stream-overlay",
"manifest": "https://git.geeks.gay/cosmo/dh-stream-overlay/raw/branch/main/module.json", "manifest": "https://git.geeks.gay/cosmo/dh-stream-overlay/raw/branch/main/module.json",
"download": "https://git.geeks.gay/cosmo/dh-stream-overlay/releases/download/2.0.1/dh-stream-overlay.zip", "download": "https://git.geeks.gay/cosmo/dh-stream-overlay/releases/download/2.1.0/dh-stream-overlay.zip",
"description": "A stream overlay module for Daggerheart that displays chat and a linked party actor sheet." "description": "A stream overlay module for Daggerheart that displays chat and a linked party actor sheet."
} }

View file

@ -263,6 +263,27 @@ Hooks.once("init", () => {
onChange: () => { if (document.body.classList.contains("stream")) location.reload(); } onChange: () => { if (document.body.classList.contains("stream")) location.reload(); }
}); });
game.settings.register("dh-stream-overlay", "carouselDisableFade", {
name: "DH_STREAM_OVERLAY.Settings.CarouselDisableFade",
hint: "DH_STREAM_OVERLAY.Settings.CarouselDisableFadeHint",
scope: "world",
config: true,
type: Boolean,
default: false,
onChange: () => { if (document.body.classList.contains("stream")) location.reload(); }
});
game.settings.register("dh-stream-overlay", "carouselTransitionDuration", {
name: "DH_STREAM_OVERLAY.Settings.CarouselTransitionDuration",
hint: "DH_STREAM_OVERLAY.Settings.CarouselTransitionDurationHint",
scope: "world",
config: true,
type: Number,
default: 800,
range: { min: 200, max: 5000, step: 100 },
onChange: () => { if (document.body.classList.contains("stream")) location.reload(); }
});
game.settings.register("dh-stream-overlay", "carouselGMMode", { game.settings.register("dh-stream-overlay", "carouselGMMode", {
name: "DH_STREAM_OVERLAY.Settings.CarouselGMMode", name: "DH_STREAM_OVERLAY.Settings.CarouselGMMode",
hint: "DH_STREAM_OVERLAY.Settings.CarouselGMModeHint", hint: "DH_STREAM_OVERLAY.Settings.CarouselGMModeHint",
@ -1118,6 +1139,13 @@ function injectStyles() {
const useGreen = game.settings.get("dh-stream-overlay", "useGreenScreen"); const useGreen = game.settings.get("dh-stream-overlay", "useGreenScreen");
const autoExpand = game.settings.get("dh-stream-overlay", "autoExpandChat"); const autoExpand = game.settings.get("dh-stream-overlay", "autoExpandChat");
const hideActions = game.settings.get("dh-stream-overlay", "hideChatActions"); const hideActions = game.settings.get("dh-stream-overlay", "hideChatActions");
// New Carousel Settings
const carouselEffect = game.settings.get("dh-stream-overlay", "carouselEffect");
const disableFade = game.settings.get("dh-stream-overlay", "carouselDisableFade"); // Only applies if Slide usually
const transitionDuration = game.settings.get("dh-stream-overlay", "carouselTransitionDuration") || 800;
const durationSec = transitionDuration / 1000;
const bgColor = useGreen ? "#00ff00" : "rgba(0, 0, 0, 0)"; const bgColor = useGreen ? "#00ff00" : "rgba(0, 0, 0, 0)";
const style = document.createElement("style"); const style = document.createElement("style");
@ -1662,10 +1690,17 @@ function injectStyles() {
.dh-party-grid.carousel-mode .dh-party-card { .dh-party-grid.carousel-mode .dh-party-card {
grid-area: 1 / 1 / -1 / -1; /* Stack on top of each other */ grid-area: 1 / 1 / -1 / -1; /* Stack on top of each other */
opacity: 0;
/* Default State (Hidden/Exiting) */
${(disableFade && carouselEffect === 'slide') ? 'opacity: 1;' : 'opacity: 0;'}
visibility: hidden; visibility: hidden;
/* TRANSITION FIX: Delay visibility hide so it fades out first */ /* TRANSITION FIX: Delay visibility hide so it fades out first */
transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out, visibility 0s linear 0.8s; /* If Fade Disabled, we still need transition for Transform */
transition: ${(disableFade && carouselEffect === 'slide') ?
`transform ${durationSec}s ease-in-out, visibility 0s linear ${durationSec}s` :
`opacity ${durationSec}s ease-in-out, transform ${durationSec}s ease-in-out, visibility 0s linear ${durationSec}s`};
pointer-events: none; pointer-events: none;
width: 100%; width: 100%;
max-width: 600px; /* Constrain width in carousel */ max-width: 600px; /* Constrain width in carousel */
@ -1677,7 +1712,9 @@ function injectStyles() {
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
/* Show immediately */ /* Show immediately */
transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out, visibility 0s linear; transition: ${(disableFade && carouselEffect === 'slide') ?
`transform ${durationSec}s ease-in-out, visibility 0s linear` :
`opacity ${durationSec}s ease-in-out, transform ${durationSec}s ease-in-out, visibility 0s linear`};
pointer-events: auto; pointer-events: auto;
z-index: 10; z-index: 10;
transform: none; transform: none;
@ -1689,7 +1726,7 @@ function injectStyles() {
/* Slide */ /* Slide */
.dh-party-grid.carousel-mode.effect-slide .dh-party-card { .dh-party-grid.carousel-mode.effect-slide .dh-party-card {
transform: translateX(50px); transform: translateX(120%);
} }
.dh-party-grid.carousel-mode.effect-slide .dh-party-card.active-slide { .dh-party-grid.carousel-mode.effect-slide .dh-party-card.active-slide {
transform: translateX(0); transform: translateX(0);