How can I rotate based on a value imported from json?

I would like to rotate based on an imported json value.

Assume you have a rotate.json with the following content:

{
"rotate": 45
}

In the same directory, you have a .typ file with the following content:

#let deg = json("rotate.json").at("rotate") * 1deg
#rotate(deg, [Foo])

You will achieve the effect as shown in the image:
image

5 Likes

Found a workaround:

rotate(10deg + 1deg * data.angle, [content])

The key is multiplying by a base value otherwise it complains.

That’s exactly what @HPCesia proposed as a solution.

2 Likes