I'm trying to create a Filter in SparkAR with random names cycling from an array on a 3D Text Layer
I made a node generating random number and sent to the script file to rool the names inside the array.
But the follow error return in the console for me:
Warning: Possible Unhandled Promise Rejection:
Error: valueOf() called on a Signal. This probably means that you are trying to perform an arithmetic operation on a signal like +, -, *, etc. Use functions .add, .sub(), etc on the signal instead or .subscribeWithSnapshot() on an EventSource to get the signal's current value on a callback.at anonymous
(file:///polyfill.js:1:2983)at anonymous (file:///polyfill.js:1:1306)at anonymous (file:///polyfill.js:1:147)
i'm using this script:
const Scene = require('Scene');
const Patches = require('Patches');
const Reactive = require( 'Reactive');
export const Diagnostics = require('Diagnostics');
;(async function () {
var randomNumber = await Patches.outputs.getScalar('randomNumberVar');
var names = ["Alice", "Bob", "Charlie", "David", "Eve"];
var chosenName = names[randomNumber];
await Patches.inputs.setString('chosenNameVar', chosenName);
})();
and this patch:
I just want make the names roll inside the effect in a 3D Text Layer
Can someone help me please