NativeUIModule Overview
NativeUIModule Overview


Describes an object which controls the behavior of the NativeUI's slider.

Requires the Native UI Control > Slider capability within the project's Properties to be enabled.


// Update a material's opacity using the value of the NativeUI slider
// Project setup:
// * One material: material0
// * One plane with material0 set as its material
// Required project capabilities:
// * NativeUI > Slider

// Load in the required modules
const NativeUI = require('NativeUI');
const Materials = require('Materials');

(async function () { // Enables async/await in JS [part 1]

  // Locate the material in the project
  const material = await Materials.findFirst('material0');

  // Create a reference to the NativeUI's slider object and display it
  const slider = NativeUI.slider;
  slider.visible = true;

  // Subscribe to changes to the slider's value property
  slider.value.monitor().subscribe(function(val) {

    // Use the new slider value to update the material's opacity
    material.opacity = val.newValue;

})(); // Enables async/await in JS [part 2]


(get) value: ScalarSignal
(set) value: ScalarSignal

The value of the slider object, as a scalar signal between 0 and 1.
(get) (Not Available)
(set) visible: BoolSignal | boolean

The visibility of the slider object, set via a boolean value.


This module exposes no methods.

Was this article helpful?