Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some animation! #21

Merged
merged 10 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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, .logo .b) {
animation: none;
stroke-dasharray: 100 100;
}
}

.header {
Expand Down
Loading