Generated dancer: render quality #679
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This improves the render quality of a generated dancer in dance party.
We've seen that the Lottie renderer does a nice job of rendering the generated dancer into a canvas, using the full resolution of the provided canvas to render nice anti-aliased shapes, as seen in the Generate Dancer levels of the Hour of AI 2025 progression.
Before now, the generated dancer in a dance party looked fairly pixelated, with noticeable aliasing artifacts. On a retina display with a pixel density of 2, the dancer was first rendered into a 400x400 canvas. This was then rendered into the final canvas, which is actually 800x800 pixels, at a 600x600 size.
Now, we take advantage of the fact that the generated dancer is rendered in this progression at a consistent size to improve this pipeline a little. We have Lottie render the dancer into a 600x600 canvas. This is then rendered into the final 800x800 canvas, unchanged.
The result is a higher resolution dancer with somewhat fewer aliasing issues.
It's worth noting that the final 800x800 canvas is then scaled to the size of its element on the screen. It would be interesting to always size this canvas to its onscreen size, but out of scope for now.
Thanks to @mikeharv for trying this out and sharing some more scenarios that this code could support if we introduce more blocks in the future. As a result, it supports size (both "set to" and "change by") and position (initial, "set to", and "change by").
Tested with pixel density of 1, 2, and 3.
Screenshots
Screenshots at pixel density of 2:
Before
After