Animate cetz-plots #144
Replies: 3 comments 4 replies
-
Could you give some context for your problem. How have you imported CeTZ, and what version are you using? The Touying docs also has a section about the CetZ integration. |
Beta Was this translation helpful? Give feedback.
-
I am doing the following: #import "@preview/cetz:0.3.1"
#import "@preview/touying:0.5.5": *
#import "@preview/cetz-plot:0.1.0": plot, chart
// cetz bindings for touying
#let cetz-canvas = touying-reducer.with(
reduce: cetz.canvas,
cover: cetz.draw.hide.with(bounds: true),
)
#cetz-canvas({
import cetz.draw: *
plot.plot(
size: (5, 5),
{
plot.add(((0, 0), (1, 4), (2, 3)))
(pause,)
plot.add(((0, 1), (1, 5), (2, 2)))
},
)
}) This does not compile. It works if I place the |
Beta Was this translation helpful? Give feedback.
-
Unfornunately, that is not possible as far as I can tell, you can however achieve the same effect using Please note that you also need to set a theme to make this MRE work. #import "@preview/cetz:0.3.1"
#import "@preview/touying:0.5.5": *
#import "@preview/cetz-plot:0.1.0": plot, chart
// remember to set a theme!
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "16-9")
// cetz bindings for touying
#let cetz-canvas = touying-reducer.with(
reduce: cetz.canvas,
cover: cetz.draw.hide.with(bounds: true),
)
#slide(repeat: 2, self => [
#let (uncover, only) = utils.methods(self)
#cetz.canvas({
import cetz.draw: *
let self = utils.merge-dicts(
self,
config-methods(cover: utils.method-wrapper(hide.with(bounds: true))),
)
let (uncover, only, alternatives) = utils.methods(self)
only(1,
plot.plot(
size: (5, 5),
{
plot.add(((0, 0), (1, 4), (2, 3)))
},
)
)
only(2,
plot.plot(
size: (5, 5),
{
plot.add(((0, 0), (1, 4), (2, 3)))
plot.add(((0, 1), (1, 5), (2, 2)))
},
)
)
})
]) The documentation is somewhat hidden, as the code in the CeTZ section is not up to date, but this is an example from the Other Animations section of the docs. |
Beta Was this translation helpful? Give feedback.
-
I was trying to animate a cetz-plots figure, but it seems that this is not supported. Has any of you tried this? Any advice?
For example, the following does not work:
Beta Was this translation helpful? Give feedback.
All reactions