Skip to content

Instantly share code, notes, and snippets.

@cladjidane
Created January 25, 2022 10:56
Show Gist options
  • Save cladjidane/bb7bffd275ffed97e8c469ee24d2063f to your computer and use it in GitHub Desktop.
Save cladjidane/bb7bffd275ffed97e8c469ee24d2063f to your computer and use it in GitHub Desktop.
[CSS] Animation avec tailwind, rellax et css
#polaroid-1 .polaroid-img {
/*
Astuce sur le cacl, il semblerait qu'il faile mutliplier par 1deg pour obtenir une valeur de varaiable en degré
Curiseuement, ça ne marche pas avec un + ou -, peut-être que le calcul en deg se fait sur 0 à 360 uniquement
*/
--r: calc(calc(var(--visible-y) * 100 * 20 / 100) * 1deg); /* fait une rotation de 180 max */
transform: rotate(var(--r));
}
/*
Debug pour afficher la valeur de la variable css calculée
[data-scroll="in"] :after {
--in: calc(calc(var(--visible-y) * 100 * 360 / 100) * 1);
counter-increment: test var(--in);
content: counter(test);
width: 100px;
height: 30px;
background: white;
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment