Touying: How can I access self in an ad-hoc way?

I found two ways to do it, documented in Complex Animations. The first is touying-fn-wrapper:

#touying-fn-wrapper((self: none) => {
  table(
    stroke: (x, y) => if x < 2 and y < 2 {
      1pt + self.colors.neutral-dark
    },
    [...],
  )
})

The page points out:

However, this does not work in all cases, for example if you put uncover into the context expression, you will get an error.

The other option is slide:

#slide(self => {
  table(
    stroke: (x, y) => if x < 2 and y < 2 {
      1pt + self.colors.neutral-dark
    },
    [...],
  )
})
2 Likes