Skip to content

Commit

Permalink
Flatten Astronaut
Browse files Browse the repository at this point in the history
This reduces the size of the astronaut asset (~10x) and thereby the
canister size (by ~25%).

A single frame of the original animated astronaut is extracted, and a
simple "floating" CSS animation is used to make the astronaut look
lively.
  • Loading branch information
nmattia committed Nov 28, 2023
1 parent d716df9 commit ef095a7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
Binary file added src/frontend/src/components/loader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/frontend/src/components/loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html, render } from "lit-html";
import loaderUrl from "./loader.webp";
import loaderUrl from "./loader.png";

const loader = () => html` <div id="loader" class="c-loader">
<img class="c-loader__image" src=${loaderUrl} alt="loading" />
Expand Down
Binary file removed src/frontend/src/components/loader.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/frontend/src/spa.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import loaderUrl from "$src/components/loader.webp";
import loaderUrl from "$src/components/loader.png";
import { showWarningIfNecessary } from "./banner";
import { displayError } from "./components/displayError";
import { anyFeatures, features } from "./features";
Expand Down
22 changes: 20 additions & 2 deletions src/frontend/src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2735,14 +2735,32 @@ input[type="checkbox"] {
background: var(--rc-overlay-backdrop);
}

/* Pretend the astronaut is moving in space */
@keyframes astrodance {
0% {
transform: translate(-50%, -50%) rotate(-20deg);
}

50% {
transform: translate(-50%, -50%) rotate(10deg);
}

100% {
transform: translate(-50%, -50%) rotate(-20deg);
}
}

.c-loader__image {
width: 125px;
width: 64px;
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
user-select: none;
animation-name: astrodance;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}

/* Wrap QR codes in a white square (for legibility) and prettify a bit */
Expand Down

0 comments on commit ef095a7

Please sign in to comment.