3D Lingo Dictionary > O-S > preScale() |  |

preScale()

Syntax

    transformReference.preScale( xScale, yScale, zScale )
    transformReference.preScale( vector )
    member( whichCastmember ).node.transform.preScale( xScale, yScale, zScale )
    member( whichCastmember ).node.transform.preScale( vector )

Description

3D transform command; applies a scale prior to the existing positional, rotational, and scaling effects of the given transform.

`Node` may be a reference to a model, group, light, or camera.

Example

Line 1 of the following Lingo creates a duplicate of Moon1's transform. Remember that access to a model's transform property is by reference.

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. Note that using `preRotate()` would have left Moon2 in the same place as Moon1, spun around its own X axis by 180 degrees.

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