📐 Transforming Content

Learn how to move, scale, rotate, and add text to 3D content in AR.js.

Moving, scaling, and rotating 3D content

Using touch screen gestures

You can use touch screen gestures to temporarily transform 3D content.

Rotate content by taping the screen with one finger and moving the finger around the screen.

Scale content by pinching the screen with two fingers.

Using metadata

You can use metadata to persistently transform 3D content.

If the content is too big or too small or if you'd like to move or rotate it, got back to the console and add metadata to affect its transformation. After adding metadata refresh the browser.

The following keys are words the system uses as pre-defined metadata keys to control transformations:

Keyword

Type

Options

Effect

x

float

Any positive or negative number.

Default value is 0.

Moves the hologram on the x-axis

y

float

Any positive or negative number.

Default value is 0.

Moves the hologram on the y-axis

z

float

Any positive or negative number.

Default value is 0.

Moves the hologram on the z-axis

scale

float

Any positive number.

Default value is 1.

Grows or shrinks the hologram uniformly

height

integer

Any positive number.

Set the height of a image hologram or a video hologram

width

integer

Any positive number.

Set the width of a image hologram or a video hologram

xAngle

float

Any positive or negative number.

Default value is 0.

Rotates the model on the x-axis

yAngle

float

Any positive or negative number.

Default value is 0.

Rotates the model on the y-axis

zAngle

float

Any positive or negative number.

Default value is 0.

Rotates the model on the z-axis

Remember to refresh the browser after adding metadata with AR.js experiences for the changed to take affect.

Adding text to 3D content

If you'd like to annotate the content, got back to the console and add metadata to add text. After adding metadata refresh the browser.

The following keys are words the system uses as pre-defined metadata keys to add and design text:

Keyword

Type

Options

Description

text

string

Any string. The character ';' represents a line break.

Text to appear with the 3D content

textColor

string

Any color.

Default value is "white".

Color of the text

textPosition

float,float

Any pair of positive or negative numbers. Default value is "0,2"

Position of the text relative to the 3D content

textScale

float

Any positive number.

Default value is "2".

Scale of the text

textBackground

string

Any string.

Default is no background.

Color of the text background plane

textBackgroundHeight

float

Any positive number.

Default value is "1".

Height of the text background plane

textBackgroundWidth

float

Any positive number.

Default value is "1".

Width of the text background plane

Remember to refresh the browser after adding metadata with AR.js experiences for the changed to take effect.

Muting 3D content

Muting is only supported for 3D videos.

If you'd like to stop a video holograms from playing sound as it is play, got back to the console and add metadata to mute it. After adding metadata refresh the browser.

The following key is a word the system uses as a pre-defined metadata key to mute a video:

Keyword

Type

Options

Effect

mute

boolean

Either 'true' of 'false'.

Default value 'false'.

Mute the sound of a video holograms.

Remember to refresh the browser after adding metadata with AR.js experiences for the changed to take effect.