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

Feature: make animated connections w/o dashed lines have icons #1949

Open
danielsuh05 opened this issue May 23, 2024 · 11 comments
Open

Feature: make animated connections w/o dashed lines have icons #1949

danielsuh05 opened this issue May 23, 2024 · 11 comments

Comments

@danielsuh05
Copy link
Contributor

Got this from looking at issue #1461.

Just some brainstorming, what would the syntax look like? Putting animated: true makes the line dashed automatically, so how would we differentiate whether the user wants a dashed line or a line with a moving icon? I'd like to take this issue if possible as well.

@cyborg-ts cyborg-ts added this to D2 May 23, 2024
@danielsuh05 danielsuh05 changed the title Animated connections w/o dashed lines have icons Feature: make animated connections w/o dashed lines have icons May 23, 2024
@alixander
Copy link
Collaborator

I think #12 is a pre-req to this.

Once connections have icons, animated: true can animate the icon instead of dashed line.

@danielsuh05
Copy link
Contributor Author

Sorry, a bit confused about what #12 is asking for. Does it mean add the ability for D2 to add an icon along a path? For example, there would be some style such that you could put a circle at any point along the path?

@bo-ku-ra
Copy link
Contributor

@alixander
Copy link
Collaborator

Yeah I know a label can do that, but I think it'd be common for users to want a label AND an icon while animating. So I don't want to animate the label

@bo-ku-ra
Copy link
Contributor

bo-ku-ra commented May 24, 2024

yes, so as follows

x -> y:  {
  label: "real label"
  style.animated: true;
  style.animation-label: "" 
}

@alixander
Copy link
Collaborator

Why introduce a new keyword? Adding a third keyword here means you expect someone to have a label, icon, AND an animated text. That's bloated

@bo-ku-ra
Copy link
Contributor

bo-ku-ra commented May 24, 2024

if i can use a charactor, i don't need any files other than the d2 source file.
very simple.
sample

@danielsuh05
Copy link
Contributor Author

Ok, just before I start to tackle the issue, just want to make sure everything is in-line with your thinking.

Ignoring animation for now, to close issue #12, I need to implement a way to add an icon to a path. The label can't clash with the icon, so either I have to move the label "up" along the path and put the icon below it or put the label adjacent to the path and have only the icon on the path. Which were you thinking? I'll start on fixing the issue.

@alixander
Copy link
Collaborator

@danielsuh05 Yes, you just have to specify the position, the renderer already has logic to move labels to their predefined position.

Although I do think it's a little too involved, hence not giving it a good first issue tag. You're welcome to try anyway if you're hearing it call your name =), but I'd suggest something with the good-first-issue tag (https://github.com/terrastruct/d2/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22), maybe something that touches the compiler, e.g.

@alixander
Copy link
Collaborator

alixander commented May 24, 2024

@bo-ku-ra You do have a point that animating some text might be what people want instead of icon. Maybe animated: icon or animated: label for connections to specify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants