Custom
The Custom
action executes code you specify.
The options object for the Custom
action has the following properties:
callback
: The code to execute, in the form of a callback function.runDuringTransition
: A boolean indicating whether the action should run during a transition. This is an optional property. If not specified, the default isfalse
.
When the button is clicked, the below example prints an "Abracadabra" message to the console and then hides the circle by setting its hidden
property to true
.
clickMeButton.onTapDown(() => {
circle.run(Action.custom({
callback: () => {
console.log("Abracadabra! The circle is hidden!");
circle.hidden = true;
},
}));
console.log("Circle custom action has begun.");
});
Unlike Move
, Scale
, and Wait
, the Custom
action doesn't have a duration
property. This is because the Custom
action doesn't have a duration -- it just executes the code you specify.
Loading...