You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the animated keyword works on connections to make them appear animated in SVGs, but it doesn't work in GIF. GIF only works for multi-board diagrams.
Reasonable for GIF to work with just one board that has an animated connection.
Reacted by Gabriel Francisco, Tom Plant, Nguyễn Anh Bình, Hari Sekhon, Maxime Brunet and Deepak Kosaraju
The animation of the connection with the animated keyword needs to fully animate a loop within the specified animate-interval (i) duration. If we just take i divided by some frame rate (f) (e.g. 100ms divided by 5, take a screenshot at 20, 40, 60, 80, 100), it might look choppy since it doesn't loop perfectly.
So we should set the duration of one perfect loop to i?
But what if you have a number of boards, and you want to pause for 5s at each board, but for the animated connections to be animated at a faster pace than a super slow motion 5s loop?
We should keep the duration of animated unrelated to i. We can just choose a frame rate such that the first and last frame match.
edit: the way we capture PNGs is to load the SVG as an image into a canvas. As an image, it won't animate.
Also, maybe --frame-rate needs to be introduced in the future to control how smooth the animation looks.
@alixander thanks for looking into this. With third-party converters, I miss the nice tooltip legend that d2's gifs have in a footer. Actually stopped using animate a lot, because the legend is really useful
Activity
bo-ku-ra commentedon Oct 18, 2023
"d2.exe --animate-interval" and "style.animated: true"
what are you going to do about the coexistence?
alixander commentedon Oct 18, 2023
There's no conflict.
--animate-intervaldictates how long the GIF lingers on each board.style.animatedmakes the line animated at a constant rate.bo-ku-ra commentedon Oct 19, 2023
i could not imagine that each one is animated in its own time interval in the gif file.
but you said there was no problem. thank you.
milon commentedon Feb 17, 2024
I tried this-
Then export like this-
It the preview it works, as well as in the svg export. But for gif export, it doesn't animate.
I am on Mac by the way.
pl4nty commentedon Sep 4, 2024
+1, a lot of apps (eg Slack) don't support SVGs. I'm working around it with an SVG->GIF service, but it loses tooltips
HariSekhon commentedon Oct 5, 2024
I ran into this problem when trying to post a generated animated SVG to LinkedIn.
Need to convert to gif but d2lang's gif generation doesn't animate and also it loses the dark
--theme 200for some reason (issue #2138)alixander commentedon Oct 5, 2024
@pl4nty losing tooltips can't be helped, since gifs are images and images aren't interactive
alixander commentedon Oct 5, 2024
dev notes:
The animation of the connection with the
animatedkeyword needs to fully animate a loop within the specifiedanimate-interval(i) duration. If we just takeidivided by some frame rate (f) (e.g. 100ms divided by 5, take a screenshot at 20, 40, 60, 80, 100), it might look choppy since it doesn't loop perfectly.So we should set the duration of one perfect loop to
i?But what if you have a number of boards, and you want to pause for 5s at each board, but for the animated connections to be animated at a faster pace than a super slow motion 5s loop?
We should keep the duration of
animatedunrelated toi. We can just choose a frame rate such that the first and last frame match.edit: the way we capture PNGs is to load the SVG as an image into a canvas. As an image, it won't animate.
Also, maybe
--frame-rateneeds to be introduced in the future to control how smooth the animation looks.pl4nty commentedon Oct 5, 2024
@alixander thanks for looking into this. With third-party converters, I miss the nice tooltip legend that d2's gifs have in a footer. Actually stopped using animate a lot, because the legend is really useful