terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
16.45k stars 411 forks source link

Feature Request: Controlling animation speed #1698

Open kevinmichaelchen opened 10 months ago

kevinmichaelchen commented 10 months ago

Is something like this possible?

style: {
  animated: true
  # integer between 1 and 10
  animation-speed: 5
}
alixander commented 10 months ago

Hmm no. Is there an example you have where it's too fast/slow? Or are you trying to do something different

kevinmichaelchen commented 10 months ago

The example I have in mind is to diagram a race condition. The varying speeds could be helpful in emphasizing which part of the race condition typically wins.

On Thu, Nov 2, 2023 at 11:13 PM Alexander Wang @.***> wrote:

Hmm no. Is there an example you have where it's too fast/slow? Or are you trying to do something different

— Reply to this email directly, view it on GitHub https://github.com/terrastruct/d2/issues/1698#issuecomment-1791844313, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHEOCWNIVZKOV3PZVEVEJ3YCROOFAVCNFSM6AAAAAA63EQCIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJRHA2DIMZRGM . You are receiving this because you authored the thread.Message ID: @.***>

alixander commented 10 months ago

That's a good use case. @gavin-ts thoughts on introducing a new keyword here?

gavin-ts commented 10 months ago

I think being able to control this speed to makes sense:

https://github.com/terrastruct/d2/assets/85081687/7c612b00-acf0-4a88-ab0a-47ae58d0577e

alixander commented 10 months ago

I intentionally choose the less common words, to avoid conflict, which usually means more verbose.

Nah no need for negative I think. But a float value makes sense.

Maybe we just change animated to be a float.

gavin-ts commented 10 months ago

I intentionally choose the less common words, to avoid conflict, which usually means more verbose.

just talking about making about animation-speed less verbose not animated (but conflict shouldn't matter within style)

Maybe we just change animated to be a float.

an example to be clear:

a -> b: {
  style.animated: 1.5
}

I like that it is less verbose than animation-speed, but slightly dislike that it doesn't really read very grammatically.

other options for comparison:

a -> b: {
  style.animation-speed: 1.5
}
a -> b: {
  style.speed: 1.5
}

maybe animation-speed is the clearest even though its a little more verbose

kevinmichaelchen commented 6 months ago

just checkin back in

alixander commented 4 months ago

another use case is slowing down animations when too many

Screenshot 2024-04-09 at 3 30 39 PM

https://stackoverflow.com/questions/53399421/svg-animations-sluggish-poor-performance-in-chrome