cetz
cetz copied to clipboard
Refactor & Improve Marks
Changes:
- Marks draw functions now return elements
- The mark tip/base offset is now calculated by using new "tip" and "base" anchors
- The marks length is auto determined
Visual Changes:
- Straight marks have no default extra padding anymore, can be set by via the mark-style
New Features:
- Users can provide custom marks using the new
register-mark()
API
#canvas({
import draw: *
register-mark("face", style => {
circle((0,0), radius: .5, fill: yellow)
arc((0,0), start: 180deg + 30deg, delta: 180deg - 60deg, anchor: "origin", radius: .3)
circle((-.15, +.15), radius: .1, fill: white)
circle((-.10, +.10), radius: .025, fill: black)
circle((+.15, +.15), radius: .1, fill: white)
circle((+.20, +.10), radius: .025, fill: black)
anchor("tip", (+.5, 0))
anchor("base", (-.5, 0))
}, mnemonic: ":)")
catmull((-3, 0), (-1,1), (1,-1), (3,0), mark: (
end: "face", start: (symbol: ":)", flip: true, reverse: true), ))
})
Ping: @Jollywatt