-
Notifications
You must be signed in to change notification settings - Fork 43
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
Use Cassette to record animations #112
Conversation
Codecov Report
@@ Coverage Diff @@
## master #112 +/- ##
=========================================
- Coverage 77.58% 76.1% -1.48%
=========================================
Files 14 14
Lines 397 406 +9
=========================================
+ Hits 308 309 +1
- Misses 89 97 +8
Continue to review full report at Codecov.
|
Wow, this is a really good idea! I had never thought of handling animation this way, but it makes a lot of sense. If this works well for you I'm happy to delete the old AnimationVisualizer. I think this should also make animating arrows easier, since they previously had the same problem that MechanismVisualizer did, where you had to recreate the ArrowVisualizer inside each frame of the animation. |
Added the deprecation and removed |
I've been using this for a couple of days now and haven't run into any issues (after working around and later fixing JuliaLabs/Cassette.jl#89). So if you're also happy with this change, I'd love to get it merged. |
Yeah, this is great. Merging! |
I realized today that Cassette is exactly the right tool to record visualizations. Even the name fits.
I've disliked
AnimationFrameVisualizer
for a while; it's almost aVisualizer
but not quite, and it makes it harder to set up animations for specific purposes. For example, in MeshCatMechanisms we have asetanimation!
overload with the lines:Even though we already had a
MechanismVisualizer
all set up and ready to go, we're creating a new one at every frame fromframe_visualizer
, just so we can use the same API to modify the underlyingAnimationFrameVisualizer
. This makesMechanismVisualizer
more complicated than it needs to be (parameterized on the type of itsvisualizer
field), and it means that you can't really do any useful work in theMechanismVisualizer
constructor.The basic goal of
AnimationFrameVisualizer
is to intercept calls tosetprop!
andsettransform!
, and Cassette is designed for just that. With Cassette, there's no longer a need to parameterizeMechanismVisualizer
(or anyMeshCat.Visualizer
-holder) on the visualizer type in order to support animation, andsimplifies to
I kept the old
AnimationFrameVisualizer
for now, but I actually think we can just get rid of it entirely in a pretty-much backwards-compatible fashion by just returningvis
asframe_vis
in the four-argument version ofatframe
.