Compare commits
15 commits
main
...
label-wiki
Author | SHA1 | Date | |
---|---|---|---|
|
d0efe739e8 | ||
|
3b0acc7e20 | ||
|
274bbef305 | ||
|
d003bbb8d8 | ||
|
ddfea36db0 | ||
|
ef8acfd788 | ||
|
74c59d1dc0 | ||
|
d20e4aaab9 | ||
|
d9de2b30bd | ||
|
6283936170 | ||
|
72f30c4319 | ||
|
8e269d3e55 | ||
|
e5df39ed50 | ||
|
2ca54a5e91 | ||
|
efc93b142a |
|
@ -66,17 +66,17 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="https://guide.deuxfleurs.fr/" role="menuitem" aria-label="wiki" class="icone">
|
<a href="https://guide.deuxfleurs.fr/" role="menuitem" aria-label="wiki" class="icone">
|
||||||
<pre aria-hidden="true">
|
<pre aria-hidden="true">
|
||||||
((((((()
|
(((((((()
|
||||||
|------|
|
|-------|
|
||||||
| WIKI |
|
| GUIDE |
|
||||||
|------|
|
|-------|
|
||||||
|______| </pre>
|
|_______| </pre>
|
||||||
<pre class="img_top" aria-hidden="true">
|
<pre class="img_top" aria-hidden="true">
|
||||||
((((((()
|
(((((((()
|
||||||
/-----/|
|
/------/|
|
||||||
/-----/ |
|
/------/ |
|
||||||
/_____/ |
|
/______/ |
|
||||||
|______| </pre>
|
|_______| </pre>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -1,47 +1,44 @@
|
||||||
// dictionary to keep track of frame count for each animation
|
// dictionary to keep track of frame count for each animation
|
||||||
let frameCounts = {};
|
let frameCounts = {};
|
||||||
|
|
||||||
function animate(id, delay) {
|
function animate(id, delay) {
|
||||||
|
|
||||||
// get the container and frames for the amination
|
// get the container and frames for the amination
|
||||||
const container = document.getElementById(id);
|
const container = document.getElementById(id);
|
||||||
const frames = container.children;
|
const frames = container.children;
|
||||||
|
|
||||||
// set up the frame counter
|
// set up the frame counter
|
||||||
frameCounts[id] = 0;
|
frameCounts[id] = 0;
|
||||||
|
|
||||||
// hide all frames except for the first
|
// hide all frames except for the first
|
||||||
frames[0].style.display = "flex";
|
frames[0].style.display = "flex";
|
||||||
for (let i = 1; i < frames.length; i++) {
|
for (let i = 1; i < frames.length; i++) {
|
||||||
frames[i].style.display = "none";
|
frames[i].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the animation
|
// start the animation
|
||||||
const interval = setInterval(updateAnimation, delay, id, frames, frames.length);
|
const interval = setInterval(updateAnimation, delay, id, frames, frames.length);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAnimation(id, frames, totalFrames) {
|
function updateAnimation(id, frames, totalFrames) {
|
||||||
|
|
||||||
// increment the frame counter for the given id
|
// increment the frame counter for the given id
|
||||||
frameCounts[id] = (frameCounts[id] + 1) % totalFrames;
|
frameCounts[id] = (frameCounts[id] + 1) % totalFrames;
|
||||||
|
|
||||||
// show the next frame
|
// show the next frame
|
||||||
frames[frameCounts[id]].style.display = "flex";
|
frames[frameCounts[id]].style.display = "flex";
|
||||||
|
|
||||||
// hide the previous frame
|
// hide the previous frame
|
||||||
if (frameCounts[id] == 0) {
|
if (frameCounts[id] == 0) {
|
||||||
frames[totalFrames - 1].style.display = "none";
|
frames[totalFrames - 1].style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
frames[frameCounts[id] - 1].style.display = "none";
|
frames[frameCounts[id] - 1].style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user have a setting on their device to minimize the amount of non-essential motion
|
animate("illustration-accueil", 500);
|
||||||
const preferReduceMotion = window.matchMedia("(prefers-reduced-motion)").matches;
|
animate("rennes", 1000);
|
||||||
|
animate("orsay", 2000);
|
||||||
animate("illustration-accueil", preferReduceMotion ? 1500 : 500); // Reduce framerate if use preference is to reduce motion
|
animate("parterre", 1500);
|
||||||
animate("rennes", preferReduceMotion ? 3000 : 1000); // Reduce framerate if use preference is to reduce motion
|
|
||||||
animate("orsay", preferReduceMotion ? 4000 : 2000); // Reduce framerate if use preference is to reduce motion
|
|
||||||
animate("parterre", 1500);
|
|
Loading…
Reference in a new issue