Examples
Reusable Motif Definition
// File: motifs/flower_center.tatml
pattern "Flower Center" {
thread: size20
center_ring: R(4, p:n, 4, p:ne, 4, p:e, 4, p:se, 4, p:s, 4, p:sw, 4, p:w, 4, p:nw, 4)
}
Pattern Using Motifs
// File: garden_doily.tatml
import "./motifs/flower_center.tatml" as flower_center
import "./motifs/connecting_chain.tatml" as connector
pattern "Garden Doily" {
thread: size20, white
// Center motif
center: use flower_center
// Surrounding motifs
repeat 8 {
motif[current]: use flower_center with {
connect center.center_ring.picot[current] to flower_center.center_ring.n
}
if not_last {
bridge[current]: use connector with {
connect motif[current].center_ring.e to connector.start,
connect motif[current+1].center_ring.w to connector.end
}
}
}
}
Nested Pattern References
import "./basic/ring.tatml" as basic_ring
import "./motifs/petal.tatml" as petal // petal uses basic_ring
pattern "Complex Flower" {
// Petal pattern already includes basic_ring elements
repeat 12 {
petal[current]: use petal
if current > 1 {
connect petal[current].tip to petal[current-1].base
}
}
}