Skip to content

Conversation

@breville
Copy link
Member

@breville breville commented Nov 15, 2025

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

Screenshot 2025-11-14 at 7 14 50 PM

After

Screenshot 2025-11-14 at 7 14 46 PM

Comment on lines -702 to -703
sprite.x - location.x,
sprite.y - location.y
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was 0, 0 when the dancer remained in its starting location, or caused drift when it was moved. Hardcoding to 0, 0 fixes the latter situation.

@breville breville requested review from a team and dju90 November 16, 2025 00:26
Copy link
Contributor

@mikeharv mikeharv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! Great that we were actually able to simplify some of the sprite functions as well!

@breville breville merged commit aa5c512 into main Nov 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants