Page Orientation
Orientation
Orientation is a property of the browser plane. This property can be used to manage or alter the browser plane's orientation to 'upright' or 'flat'.
This API is provided as a developer preview and is subject to change.
There are two orientation options defined by the MLPageOrientation enum: upright and flat.
Syntax
Getter
Return the orientation property of a browser plane. The return value is either "upright" or "flat".
var orientation = window.mlWorld.orientation;
Setter
Set the orientation property of a browser plane. The input value is either "upright" or "flat".
window.mlWorld.orientation = “flat”;
Property Values
MLPageOrientation { "upright", "flat" }
upright: Rotation of the browser plane is (0, 0, 0).
flat: Rotation of the browser plane is (-90deg, 0, 0).
mlpageorientation Event
This event is dispatched after browser plane's orientation changes to 'upright' or 'flat'
mlpageorientation
document.addEventListener('mlpageorientation', (e) => {
//animate turkey model once the page orientation changes to flat.
if (window.mlWorld.orientation === 'flat') {
turkeyModel.animation = 'fly';
}
});