direction自始可用
The four directions into which content can be laid out.
Possible values are: ltr, rtl, ttb, and btt.
These values are available globally and also in the direction type’s scope, so you can write either of the following two:
#stack(dir: rtl)[A][B][C]
#stack(dir: direction.rtl)[A][B][C]

常量
ltrdirection自始可用
Left to right.
展开示例
#stack(
dir: ltr,
spacing: 0.2cm,
circle(),
line(),
square(),
)

rtldirection自始可用
Right to left.
展开示例
#stack(
dir: rtl,
spacing: 0.2cm,
circle(),
line(),
square(),
)

ttbdirection自始可用
Top to bottom.
展开示例
#stack(
dir: ttb,
spacing: 0.2cm,
circle(),
line(),
square(),
)

bttdirection自始可用
Bottom to top.
展开示例
#stack(
dir: btt,
spacing: 0.2cm,
circle(),
line(),
square(),
)

函数
from0.14.0起可用
Returns a direction from a starting point.
This function does the opposite of direction.start.
展开示例
#direction.from(left) \
#direction.from(right) \
#direction.from(top) \
#direction.from(bottom)

side
The starting point for the direction.
This cannot be start or end.
to0.14.0起可用
Returns a direction from an end point.
This function does the opposite of direction.end.
展开示例
#direction.to(left) \
#direction.to(right) \
#direction.to(top) \
#direction.to(bottom)

side
The end point for the direction.
This cannot be start or end.
axis0.7.0起可用
The axis this direction belongs to, either "horizontal" or "vertical".
展开示例
#ltr.axis() \
#ttb.axis()

sign0.14.0起可用
The corresponding sign, for use in calculations.
This is the sign of the vector going this direction along the corresponding axis.
展开示例
#ltr.sign() \
#rtl.sign() \
#ttb.sign() \
#btt.sign()

start0.7.0起可用
The starting point of this direction.
This function does the opposite of direction.from.
展开示例
#ltr.start() \
#rtl.start() \
#ttb.start() \
#btt.start()

end0.7.0起可用
The end point of this direction.
This function does the opposite of direction.to.
展开示例
#ltr.end() \
#rtl.end() \
#ttb.end() \
#btt.end()

inv自始可用
The inverse (opposite) direction.
展开示例
#ltr.inv() \
#rtl.inv() \
#ttb.inv() \
#btt.inv()
