Skip to content
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

Allow linkStyle to be animated #5574

Open
cmnstmntmn opened this issue Jun 16, 2024 · 1 comment · May be fixed by #5650
Open

Allow linkStyle to be animated #5574

cmnstmntmn opened this issue Jun 16, 2024 · 1 comment · May be fixed by #5650
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@cmnstmntmn
Copy link

cmnstmntmn commented Jun 16, 2024

Proposal

I'm using Github gists for documentation, and i would like to have a way to allow animation between the notes.

I was trying to add custom css, but keyframes are not supported.

Possible solutions:

Add new char for lines to mark that that link is animated

Current implementation - no animation

Length 1 2 3
Normal --- ---- -----
Normal with arrow --> ---> ---->
Thick === ==== =====
Thick with arrow ==> ===> ====>
Dotted -.- -..- -...-
Dotted with arrow -.-> -..-> -...->

How to mark a line for having an animated behaviour

Length 1 2 3
Normal ---^ ----^ -----^
Normal with arrow -->^ --->^ ---->^
Thick ===^ ====^ =====^
Thick with arrow ==>^ ===>^ ====>^
Dotted -.-^ -..-^ -...-^
Dotted with arrow -.->^ -..->^ -...->^

Proposed implementation - with animation (preferred)

^ pin operator will mark that:

  • a dotted line will have a moving infinite animation

dotted-line

  • a normal line will have a fade in/ fade out infinite animation

normal-line

Add a new keyframesDef property

I think adding support for keyframes like keyframesDef, the same way like classDef

graph RL
    A:::className -.-> B
    classDef className fill:green;
    keyframesDef animationName 0% stroke-dashoffset: 0, 100% stroke-dashoffset: 0 color: red
    linkStyle 0 animation: animationName 1s linear infinite;

Example

https://d2lang.com/tour/style#animated

example-nodes

Screenshots

No response

@cmnstmntmn cmnstmntmn added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Jun 16, 2024
@cmnstmntmn
Copy link
Author

I've made some progress on this.

animated-graph

@cmnstmntmn cmnstmntmn linked a pull request Jul 17, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant