feat: Add a setting and animation for the fear tracker when it reaches maximum value.
This commit is contained in:
parent
8a01374d3f
commit
70929ef693
3 changed files with 63 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "dh-feartrackerplus",
|
"id": "dh-feartrackerplus",
|
||||||
"title": "Daggerheart Fear Tracker Plus",
|
"title": "Daggerheart Fear Tracker Plus",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "13",
|
||||||
"verified": "13"
|
"verified": "13"
|
||||||
|
|
@ -32,6 +32,6 @@
|
||||||
],
|
],
|
||||||
"url": "https://github.com/cptn-cosmo/dh-feartrackerplus",
|
"url": "https://github.com/cptn-cosmo/dh-feartrackerplus",
|
||||||
"manifest": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/latest/download/module.json",
|
"manifest": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/latest/download/module.json",
|
||||||
"download": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/download/1.0.0/dh-feartrackerplus.zip",
|
"download": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/download/1.1.0/dh-feartrackerplus.zip",
|
||||||
"description": "Customizes the Fear Tracker for Daggerheart."
|
"description": "Customizes the Fear Tracker for Daggerheart."
|
||||||
}
|
}
|
||||||
|
|
@ -123,6 +123,16 @@ Hooks.once('init', () => {
|
||||||
default: 1.0,
|
default: 1.0,
|
||||||
onChange: refreshFearTracker
|
onChange: refreshFearTracker
|
||||||
});
|
});
|
||||||
|
|
||||||
|
game.settings.register(MODULE_ID, 'maxFearAnimation', {
|
||||||
|
name: 'Max Fear Animation',
|
||||||
|
hint: 'animate the fear tracker when it reaches maximum value.',
|
||||||
|
scope: 'client',
|
||||||
|
config: true,
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
onChange: refreshFearTracker
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -454,4 +464,27 @@ function injectFearCustomization(html) {
|
||||||
// Remove legacy container class if present
|
// Remove legacy container class if present
|
||||||
fearContainer.classList.remove('fear-tracker-plus-container-gradient');
|
fearContainer.classList.remove('fear-tracker-plus-container-gradient');
|
||||||
fearContainer.style.background = 'none';
|
fearContainer.style.background = 'none';
|
||||||
|
|
||||||
|
// Max Fear Animation
|
||||||
|
const animateMax = game.settings.get(MODULE_ID, 'maxFearAnimation');
|
||||||
|
if (animateMax) {
|
||||||
|
// Check if all available icons are active
|
||||||
|
// Icons are "active" if they don't have the 'inactive' class.
|
||||||
|
// Wait, looking at the code above, 'inactive' class checks are used.
|
||||||
|
// Let's count totals.
|
||||||
|
const activeIcons = Array.from(icons).filter(icon => !icon.classList.contains('inactive')).length;
|
||||||
|
|
||||||
|
// If totalIcons > 0 and activeIcons === totalIcons, apply animation
|
||||||
|
if (totalIcons > 0 && activeIcons === totalIcons) {
|
||||||
|
icons.forEach(icon => {
|
||||||
|
icon.classList.add('fear-tracker-plus-animate');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
icons.forEach(icon => {
|
||||||
|
icon.classList.remove('fear-tracker-plus-animate');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
icons.forEach(icon => icon.classList.remove('fear-tracker-plus-animate'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,37 @@
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text;
|
||||||
background-clip: text;
|
background-clip: text;
|
||||||
-webkit-text-fill-color: transparent;
|
-webkit-text-fill-color: transparent;
|
||||||
display: inline-block; /* Required for gradient text */
|
display: inline-block;
|
||||||
|
/* Required for gradient text */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the icon keeps its size and doesn't collapse */
|
/* Ensure the icon keeps its size and doesn't collapse */
|
||||||
#resource-fear i.fear-tracker-plus-custom {
|
#resource-fear i.fear-tracker-plus-custom {
|
||||||
transition: all 0.5s ease;
|
transition: all 0.5s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes fearPulse {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: scale(1.1);
|
||||||
|
filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.5));
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#resource-fear i.fear-tracker-plus-animate {
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
transform-origin: center center;
|
||||||
|
animation: fearPulse 2s infinite ease-in-out;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue