Layout

altspace/utilities/behaviors. Layout

The Layout behavior allows you to position objects easily. You can position an object relative to its parent (either the Scene or a another object) by using a position specifier for each of the axes. The position specifier can be one of 'min', 'center' or 'max'. The default specifier is 'center'. You can also add a modifier to the position in pixels ('min+5'), a percentage ('min+10%') or meters ('min+1m'). Finally, you can choose the location of the anchor on the object you are trying to position by using the 'my' parameter. You must specify at least one axis on the 'at' parameter.

Constructor

new Layout(config)

Parameters:
Name Type Description
config Object
Properties
Name Type Attributes Description
at Object

An object containing the axes and position specifiers. At least one axis must be specified. E.g. {x: 'min', y: 'max-5%'}

my Object <optional>

An object containing the axes and position specifiers for the layout anchor.

Example
// Position the top of the cube at 1.5 meters above the bottom of its parent.
cube.addBehavior(new altpsace.utilities.behaviors.Layout({
	   my: {y: 'max'},
	   at: {y: 'min+1.5m'}
});

Extends

Members

type :string

The string name of this class. This is used for THREE.Object3D#getBehaviorByType.

Overrides:

Methods