feat: compare animation

This commit is contained in:
Matthieu Bessat 2023-05-27 17:28:51 +02:00
parent 9c65550605
commit 3b7d7f2a62
2 changed files with 63 additions and 11 deletions

View file

@ -106,7 +106,45 @@
}
}
@keyframes compare-anim {
0% {
clip-path: inset(100% 100% 100% 0%);
}
100% {
clip-path: inset(100% 100% 100% 100%);
}
}
.compare-items-dynamic {
.compare-duet {
overflow: hidden;
position: relative;
.compare-hidden {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
clip-path: inset(100% 100% 100% 0%);
}
}
.compare-duet:hover {
.compare-hidden {
animation: compare-anim 2s cubic-bezier(.86,0,.07,1);
animation-fill-mode: forwards;
}
}
}
}
@media (max-width: $sm-breakpoint) {
.compare-section {
.compare-items {
grid-template-columns: 1fr;
}
}
}
.history-summary {
display: grid;
@ -125,3 +163,4 @@
border-bottom: 1px solid rgba(1, 1, 1, 0.2);
}
}

View file

@ -61,25 +61,38 @@
<section class="compare-section">
<div class="page-container">
<h2>Un petit bout de palestine en Normandie...</h2>
<div class="compare-items">
<div class="compare-item">
<div class="compare-items compare-items-dynamic">
<div class="compare-item compare-east">
<figure>
{{ $image := resources.Get "images/crypte_comparaison_01_aubevoye.jpg" }}
<img class="compare-aubevoye" src="{{ $image.RelPermalink }}" />
<div class="compare-duet">
<div class="compare-hidden">
{{ $image := resources.Get "images/crypte_comparaison_01_judee.jpg" }}
<img class="compare-judee" src="{{ $image.RelPermalink }}" />
<img class="" src="{{ $image.RelPermalink }}" />
</div>
<div class="compare-shown">
{{ $image := resources.Get "images/crypte_comparaison_01_aubevoye.jpg" }}
<img class="" src="{{ $image.RelPermalink }}" />
</div>
</div>
<figcaption>Comparaison crypte vers l'est</figcaption>
</figure>
</div>
<div class="compare-item">
<div class="compare-item compare-west">
<figure>
{{ $image := resources.Get "images/crypte_comparaison_02_aubevoye.jpg" }}
<img class="compare-aubevoye" src="{{ $image.RelPermalink }}" />
<div class="compare-duet">
<div class="compare-hidden">
{{ $image := resources.Get "images/crypte_comparaison_02_judee.jpg" }}
<img class="compare-judee" src="{{ $image.RelPermalink }}" />
<img class="" src="{{ $image.RelPermalink }}" />
</div>
<div class="compare-shown">
{{ $image := resources.Get "images/crypte_comparaison_02_aubevoye.jpg" }}
<img class="" src="{{ $image.RelPermalink }}" />
</div>
</div>
<figcaption>Comparaison crypte vers l'ouest</figcaption>
</figure>
</figure>