polylux icon indicating copy to clipboard operation
polylux copied to clipboard

Animate with Cetz

Open kescobo opened this issue 10 months ago • 2 comments

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.

kescobo avatar Mar 29 '24 15:03 kescobo

#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

TakodaS avatar May 08 '24 08:05 TakodaS

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!

kescobo avatar May 15 '24 20:05 kescobo