Modifying scale

Scaling a 3D object involves modifying its dimensions along its local axes. A 3D object can be scaled uniformly along all three local axes, or along the local X, Y, or Z axis individually.

The scale init object parameter

The initial scale of a 3D object along all its local axes can quite often be specified with the scale init object parameter. This scales the 3D object uniformly along all three axes. In this example, we have scaled the sphere to twice its default size.

Tip

You can also supply negative numbers to these scale functions and properties, which has the effect of turning a 3D object "inside out".

var sphere:Sphere = new Sphere(
  {
    scale: 2
  }
);

The scale() function

The scale() function will apply a uniform scale to all the local axes at once. This achieves the same result as the scale init object parameter, and can be used on those 3D objects that do not implement init objects.

var sphere:Sphere = new Sphere();
sphere.scale(2);

The scaleX, scaleY, and scaleZ properties

The scale of a 3D object along its individual local axes can be specified by setting scaleX, scaleY, and scaleZ properties. Here we have used these three properties to scale a 3D object by a factor of two along the X axis, by a factor of 3 along the Y axis, and by a factor of 4 along the Z axes.

var sphere:Sphere = new Sphere();
sphere.scaleX = 2;
sphere.scaleY = 3;
sphere.scaleZ = 4;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.111.195