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

Animate with Cetz #158

Open
kescobo opened this issue Mar 29, 2024 · 2 comments
Open

Animate with Cetz #158

kescobo opened this issue Mar 29, 2024 · 2 comments

Comments

@kescobo
Copy link

kescobo commented Mar 29, 2024

Attempting to deal with a similar use case as #157, though with some additional functionality, could it be possible to use polylux animations with cetz drawings (related discussion on cetz repo)?

I tried

#slide(title: [Packages])[
  #cetz.canvas({
    import cetz.draw: *
    content((0,0), [#only(1)[#image("assets/decision-tree_1.png")]])
    // Draw a circle and place its "west" anchor at the origin.
    circle((0,0), anchor: "west")
  }) 
]

but no dice. I don't understand the internals of either package enough to have a sense of what to do.

@TakodaS
Copy link

TakodaS commented May 8, 2024

#let mycontent(show-image: true) = cetz.canvas(
  {
    if show-image {
      content((0, 0), [#image("assets/decision-tree_1.png")]) // Draw a circle and place its "west" anchor at the origin.
    };
    circle((0, 0), anchor: "west")
  },
)

//First way
#slide[
  #alternatives[#mycontent(show-image: true)][#mycontent(show-image: false)]
]

//Second way that might be too clever
#range(2).map(i =>slide[#mycontent(show-image: i == 0)]).join()

Touying allows you to insert pauses in CetZ diagrams
https://github.com/touying-typ/touying

@kescobo
Copy link
Author

kescobo commented May 15, 2024

Oh, very cool, thanks for the idea! I bet I could adapt that with a for loop to add a list of images...

And thanks for the link to touying - I see that it's also got pinit support, which I'm very keen on!

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

No branches or pull requests

2 participants