-
Notifications
You must be signed in to change notification settings - Fork 124
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
feat: data-driven and random AnimatedLogo
#268
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really, really cool. Awesome work! I love it. @lucacasonato any issues with merging this?
by extracting the logo as an ASCII drawing, and mapping over the values, we get more control over the shape, colours, animation randomness and positioning of the internal elements. the asset is a snapshot of the rendered HTML on a given page. Manual adjustments of individual blocks is easier with inline styles.
unlike the logo on the home page which has two, this asset has a single block of blank space.
ee24286
to
6d3f95f
Compare
xmlnsXlink="http://www.w3.org/1999/xlink" | ||
xml:space="preserve" | ||
style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;" | ||
viewBox="-2 -2 17 11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual drawing is 13 by 7, but accounting for a padding of 2 all around.
We could write this thusly with less magic numbers:
const padding = 2;
const width = 13;
const height = 7;
const viewBox = [
-padding,
-padding,
padding + width + padding,
padding + height + padding,
].join(' ');
Cool. I pushed a change that fixes a little glitch I saw where the server render and the client rendered random positions would not be in sync, causing a little jump of all the pixels immediately after page load (as soon as the logo re-rendered on the client). Fixed this by not re-rendering the logo on the client. Also updated the CSS to respect the |
AnimatedLogo
AnimatedLogo
Why?
By extracting the logo as an ASCII drawing, and mapping over the values, we get more control
over the shape, colours, animation randomness and positioning of the internal elements.
What?
Iterate over the ASCII representation of the logo, transforming
█
and░
blocks into their respective colours and discarding spaces to generate the individual SVGrect
.The SVG asset is a snapshot of the rendered HTML on a given page. Manual adjustments of individual blocks is easier with inline styles.