Skip to content

Commit

Permalink
Merge pull request #21 from Revolution-Hacks/animation
Browse files Browse the repository at this point in the history
add some animation!
  • Loading branch information
iamawatermelo authored Nov 7, 2024
2 parents 1541cc8 + 4f800db commit 4577a53
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/lib/images/doublearrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/lib/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ $size_lg: 64rem;
box-shadow 100ms,
transform 100ms,
filter 100ms;

@media (prefers-reduced-motion) {
transition: none;
}
}

&:hover {
Expand Down
7 changes: 7 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
@media (min-width: style.$size_md) {
--transform: translate(calc(50% - 8em), calc(50% - 2em));
}
@media (prefers-reduced-motion) {
animation: none;
transform: var(--transform);
}
}
.wall-top {
Expand Down Expand Up @@ -183,6 +188,8 @@
width: 3em;
height: 3em;
align-self: center;
stroke: rgb(var(--fg));
}
.header {
Expand Down
58 changes: 54 additions & 4 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@
background: no-repeat space url('$lib/images/train.svg') left/149em;
animation: 30s linear infinite train;
animation-delay: var(--animation-delay);
@media (prefers-reduced-motion) {
display: none;
}
}
&.reverse::after {
Expand All @@ -172,10 +176,6 @@
background-position-x: 550%;
}
}
@media (prefers-reduced-motion) {
display: none;
}
}
.gear {
Expand Down Expand Up @@ -226,6 +226,7 @@
@media (prefers-reduced-motion) {
animation: none;
transform: var(--transform);
}
}
}
Expand All @@ -242,13 +243,62 @@
padding: 8em 4em;
margin: auto;
gap: 1em;
@keyframes logo-a {
0% {
stroke-dasharray: 0 100;
}
20% {
stroke-dasharray: 100 100;
}
100% {
stroke-dasharray: 100 100;
}
}
@keyframes logo-b {
0% {
stroke-dasharray: 0 100;
}
20% {
stroke-dasharray: 0 100;
}
100% {
stroke-dasharray: 100 100;
}
}
:global(.logo) {
/* I'm not sure why this is needed. Maybe because it's another component */
grid-area: 1 / 1 / 1 / 1;
width: 3em;
height: 3em;
align-self: center;
stroke: rgb(var(--fg));
}
:global(.logo .a) {
stroke-dasharray: 0 100;
animation: 1s cubic-bezier(.05,.09,.23,1) logo-a forwards;
animation-delay: 200ms;
}
:global(.logo .b) {
stroke-dasharray: 0 100;
animation: 1s cubic-bezier(.05,.09,.23,1) logo-b forwards;
animation-delay: 200ms;
}
@media (prefers-reduced-motion) {
:global(.logo .a), :global(.logo .b) {
animation: none;
stroke-dasharray: 100 100;
}
}
.header {
Expand Down

0 comments on commit 4577a53

Please sign in to comment.