Magic Leap MagicScript Landscape Application. Vibe Pattern of the control device

**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-vibe org.magicscript.vibe "VIBE"
cd my-vibe
```

**Code**

Change app.js

```javascript
import { LandscapeApp, ui, haptics } from 'lumin';
const { UiButton } = ui;
const { VibePattern, VibeIntensity } = haptics;

export class App extends LandscapeApp {
  onAppStart () {
    let pattern = VibePattern.VIBE_BUMP;
    const app = this;
    const prism = this.requestNewPrism([0.5, 0.5, 0.5]);    
    const button = 
          UiButton.Create(prism, "BUMP", 0, 0.1);
    button.onActivateSub(function (uiEventData) {

      switch(pattern)
      {
        case VibePattern.VIBE_BUMP:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_BUZZ;
          button.setText("BUZZ");
          break;
        case VibePattern.VIBE_BUZZ:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_CLICK;
          button.setText("CLICK");
          break;
        case VibePattern.VIBE_CLICK:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_DOUBLE_CLICK;
          button.setText("DOUBLE_CLICK");
          break;
        case VibePattern.VIBE_DOUBLE_CLICK:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_FORCE_DOWN;
          button.setText("FORCE_DOWN");
          break;
        case VibePattern.VIBE_FORCE_DOWN:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_FORCE_DWELL;
          button.setText("FORCE_DWELL");
          break;
        case VibePattern.VIBE_FORCE_DWELL:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_FORCE_UP;
          button.setText("FORCE_UP");
          break;
        case VibePattern.VIBE_FORCE_UP:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_PULSE_RAW;
          button.setText("PULSE_RAW");
          break;
        case VibePattern.VIBE_PULSE_RAW:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_SECOND_FORCE_DOWN;
          button.setText("SECOND_FORCE_DOWN");
          break;
        case VibePattern.VIBE_SECOND_FORCE_DOWN:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_TAP;
          button.setText("TAP");
          break;
        case VibePattern.VIBE_TAP:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_TICK;
          button.setText("TICK");
          break;
        case VibePattern.VIBE_TICK:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_NONE;
          button.setText("NONE");
          break;
        case VibePattern.VIBE_NONE:
          vibe(app, pattern);
          pattern = VibePattern.VIBE_BUMP;
          button.setText("BUMP");
          break;
      }
    });
    prism.getRootNode().addChild(button);
  }
}

function vibe(app, VIBE)
{
  app.triggerControlBodyHaptics(VIBE, 100, VibeIntensity.HIGH);
}
```

**Build**

```
magic-script build -i
```

**Run**

```
magic-script run --port=10000
```

**Reference**
triggerControlBodyHaptics (MagicScript API)
https://docs.magicscript.org/lumin.LandscapeApp.html#triggerControlBodyHaptics

VibePattern (MagicScript API)
https://docs.magicscript.org/lumin.haptics.VibePattern.html

magicscript
https://www.magicscript.org/

Thanks!