Closed cristobaltapia closed 1 month ago
That is possible. It would be easier if Polylux exposed some public functions that take the location from locate
as argument and return instead of calling locate itself. I will take a look into this.
Thanks for considering this! Maybe I can open an issue in polylux about this.
(Polylux author here)
There is the fundamental issue that you can't hide
lines or paths in Typst. That's why Polylux' uncover
, pause
etc. don't play nicely with CeTZ at the moment.
Yes, that is because cetz lines or paths are not Typst content but dictionaries. But Polylux' uncover
returns content that must be visible in the document (locate(..)
).
I mean you could hide paths in cetz by setting their stroke and fill to none
without changing up bboxes or anchors.
Well, you still can't hide them, regardless of how CeTZ represents them intermediately. But using none
for strokes is a clever trick!
And you're right, Polylux should export some more overlay functions. Currently I'm thinking about good ways to provide information about the current subslide via a function. You could then do something like
#name-tba(args => {
cetz.canvas({
if "we're at the correct subslide" {
cetz.stroke(red)
} else {
cetz.stroke(none)
}
// ...
})
})
What would real hiding them look like? I mean, I could also suppress the draw call, without the stroke/fill none hack, but there is no such flag as of now.
I was referring to the builtin hide
function. So
#hide(line())
still shows a line, and this effect propagates to CetZ.
That's pretty clearly a bug in Typst and not something polylux or cetz should have to work around.
That's pretty clearly a bug in Typst and not something polylux or cetz should have to work around.
There's an existing issue, just under a somewhat specific name
Sry for posting to a closed issue. But I want to share a workaround for polylux' only()
and uncover()
in CeTZ with a little scripting for anyone who needs a quick solution in the meantime.
#polylux-slide[
#for i in range(1,4) [
#only(i)[
#cetz.canvas({
// only(1) in CeTZ
cetz.draw.rect((0,0), (rel: (3,3)), stroke: if (i == 1) {5pt + red} else {none})
cetz.draw.rect((4,0), (rel: (3,3)), stroke: 5pt + green)
// uncover(3-) in CeTZ
if (i >= 3) {
cetz.draw.rect((8,0), (rel: (3,3)), stroke: 5pt + blue)
}
})
]
]
]
Hi, thanks for staring this project and give Typst some nice graphic library!
I was thinking of using CetZ in a presentation with Polylux and in general it works very good. However, one feature that is not working is the use of the special functions of polylux to uncover elements (e.g.
only
,uncover
), equivalent to "overlays" in LaTex+Beamer. It would be nice if CetZ could understand/use those functions within a figure, in order to make nice animations. Certainly this has not a great urgency, but it would be a nice addition :) .