JavaScript
MagicLeap
MagicScript

Magic Leap MagicScript Landscape Application. UiLoadingSpinner

Prepare

Magic Leap One

https://www.magicleap.com/magic-leap-one

mlsdk v.0.20.0

https://creator.magicleap.com/downloads/lumin-sdk/overview

magic-script-cli v2.0.1

https://www.npmjs.com/package/magic-script-cli

magic-script-polyfills v2.2.0

https://www.npmjs.com/package/magic-script-polyfills

Create Project

magic-script init my-sp org.magicscript.sp "Spinner"

cd my-sp

Code

Change app.js

import { LandscapeApp, ui, resources } from 'lumin';

const {
UiLinearLayout
, UiCircleConfirmation
, UiText
, EclipseLabelType
, Alignment
, UiLoadingSpinner
, LoadingSpinnerType} = ui;

const {
FontStyle
, FontWeight
} = resources;

export class App extends LandscapeApp {
onAppStart () {
const prism = this.requestNewPrism([0.5, 0.5, 0.5]);
const layout = UiLinearLayout.Create(prism);
layout.setAlignment(Alignment.CENTER_CENTER);

const label3d = UiText.Create(
prism, "Particle FX Style:", FontStyle.kItalic, FontWeight.kBold);
label3d.setTextSize(0.0393);
layout.addItem(label3d
, [0, 0, 0.08, 0]
, Alignment.CENTER_LEFT);

const loadingSpinner3d = UiLoadingSpinner.Create(
prism, LoadingSpinnerType.kParticlePackage
);
layout.addItem(loadingSpinner3d
, [0, 0, 0.02, 0]
, Alignment.CENTER_CENTER);

const label2d = UiText.Create(
prism, "2D Particle FX Style:", FontStyle.kItalic, FontWeight.kBold);
label2d.setTextSize(0.0393);
layout.addItem(label2d
, [0.08, 0, 0.02, 0]
, Alignment.BOTTOM_LEFT);

const loadingSpinner2d = UiLoadingSpinner.Create(
prism, LoadingSpinnerType.k2dSpriteAnimation
);
loadingSpinner2d.setSize([0.0314, 0.0314]);
layout.addItem(loadingSpinner2d
, [0, 0, 0.02, 0]
, Alignment.BOTTOM_CENTER);
prism.getRootNode().addChild(layout);
}
}

Build

magic-script build -i

Run

magic-script run --port=10000

Reference

UiLoadingSpinner(Magic Script API Doc)

https://docs.magicscript.org/lumin.ui.UiLoadingSpinner.html

Loading Spinners (UiLoadingSpinner) (Guide C++)

https://creator.magicleap.com/learn/guides/luminrt-uiloadingspinner

magicscript

https://www.magicscript.org/

Thanks!