505
Line 2
applies a scale to that transform prior to any existing positional or rotational effects of that
transform. Assume that the transform represents the positional offset and rotational orbit of
Moon1 relative to its parent planet. Lets also assume Moon2’s parent is the same as Moon1’s. If
we used
scale()
here instead of
preScale()
, then Moon2 would be pushed out twice as far and
rotated about the planet twice as much as is Moon1. This is because the scaling would be applied
to the transform’s existing positional and rotational offsets. Using
preScale()
will apply the size
change without affecting these existing positional and rotational offsets.
Line 3
applies an additional 180° rotation about the x-axis of the planet. This will put Moon2 on
the opposite side of Moon1’s orbit. Using
preRotate()
would have left Moon2 in the same place
as Moon1, spun around its own x-axis by 180°.
Line 4
assigns this new transform to Moon2.
t = member("scene").model("Moon1").transform.duplicate()
t.preScale(2,2,2)
t.rotate(180,0,0)
member("scene").model("Moon2").transform = t
preTranslate()
Syntax
transformReference
.preTranslate(
xIncrement
,
yIncrement
, \
zIncrement
)
transformReference
.preTranslate(
vector
)
member(
whichCastmember
).
node
.transform.preTranslate\
(
xIncrement
,
yIncrement
,
zIncrement
)
member(
whichCastmember
).
node
.transform.preTranslate(
vector
)
Description
3D transform command; applies a translation before the current positional, rotational, and scale
offsets held by the referenced transform object. The translation may be specified as a set of three
increments along the three corresponding axes. These increments may be specified explicitly in
the form of
xIncrement
,
yIncrement
, and
zIncrement
, or by a vector, where the X component
of the vector corresponds to the translation about the X axis, the Y about the Y axis, and the Z
about the Z axis.
After a series of transformations are done, in the following order, the model’s local origin will be at
(0, 0, -100), assuming the model’s parent is the world:
model.transform.identity()
model.transform.rotate(0, 90, 0)
model.transform.preTranslate(100, 0, 0)
Had
translate()
been used instead of
preTranslate()
, the model's local origin would be at
(100, 0, 0) and the model rotated about its own Y axis by 90°. Note that
model.transform.pretranslate(x, y, z)
is equivalent to
model.translate(x, y, z)
.
Generally,
preTranslate()
is only useful when dealing with transform variables rather than
model.transform
references.
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...