-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
EaseFunction svg graphs in doc #17461
EaseFunction svg graphs in doc #17461
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.
I think this is a good idea. The documentation becomes massively more approachable when it's more than just type definitions; examples, tables, figures, all make it much nicer.
I do have a concern around needing to maintain this tool separately to bevy_math
. Perhaps it would be worth trying to refactor this into a proc-macro? Especially considering we're using the doc
attribute to just include the SVG string in the documentation anyway.
I like this idea, my only concern would be whether this would affect build time. |
Could use |
Will do! I'm assuming the |
https://doc.rust-lang.org/rustdoc/advanced-features.html
#[cfg_attr(doc, my_special_macro(...))] It'll only include |
After some experimentation, I don't think it'll be possible to use a proc-macro to generate the graphs. It'd require a cyclic dependency between the macro crate and |
d81280b
to
0af5ec0
Compare
# Objective After #17461, the ease function labels in this example are a bit cramped, especially in the bottom row. This adjusts the spacing slightly and centers the labels. ## Solution - The label is now a child of the plot and they are drawn around the center of the transform - Plot size and extents are now constants, and this thing has been banished: ```rust i as f32 * 95.0 - 1280.0 / 2.0 + 25.0, -100.0 - ((j as f32 * 250.0) - 300.0), 0.0, ``` - There's room for expansion in another row, so make that easier by doing the chunking by row - Other misc tidying of variable names, sprinkled in a few comments, etc. ## Before <img width="1280" alt="Screenshot 2025-02-08 at 7 33 14 AM" src="https://github.com/user-attachments/assets/0b79c619-d295-4ab1-8cd1-d23c862d06c5" /> ## After <img width="1280" alt="Screenshot 2025-02-08 at 7 32 45 AM" src="https://github.com/user-attachments/assets/656ef695-9aa8-42e9-b867-1718294316bd" />
Objective
The docs of
EaseFunction
don't visualize the different functions, requiring you to check out the Bevy repo and running theeasing_function
example.Solution
Showcase