// Load in the required modulesconst Patches = require('Patches');const Scene = require('Scene');const Diagnostics = require('Diagnostics');
let parentNames = ["AnimObject0", "Animation"]
let parentsArray = []let childArray = [];let totalFrames = 0;
// Enable async/await in JS [part 1](async function () { let name = ""
for (let anim = 0; anim < parentNames.length; anim++) { // Locate the animation parent in the Scene [parentsArray[anim]] = await Promise.all([ Scene.root.findFirst(parentNames[anim]) ]); }
//locate the text object in the scene (for debugging) const [thetext] = await Promise.all([ Scene.root.findFirst('text0') ]);
// Get the parent object's children and log their names to the console for (let anim = 0; anim < parentNames.length; anim++) { const children = await parentsArray[anim].findByPath('*'); childArray[anim] = children }
// Enable async/await in JS [part 2]})();
Patches.outputs.getScalar('frameIn').then(event => { event.monitor({}).subscribe(function (values) { // Diagnostics.log("To Script Number ".concat(values.newValue.toString())); let frame = values.newValue totalFrames++
for (let anim = 0; anim < parentNames.length; anim++) { if (childArray[anim] != null) { for (var i = 0; i < childArray[anim].length; i++) { childArray[anim][i].hidden = !(totalFrames % childArray[anim].length == i); } } } });});
// Diagnostics.log(`Child ${i} name: ${children[i].name}`);
let parentNames = ["AnimObject0", "Animation"]
let parentsArray = []let childArray = [];let totalFrames = 0;
// Enable async/await in JS [part 1](async function () { let name = ""
for (let anim = 0; anim < parentNames.length; anim++) { // Locate the animation parent in the Scene [parentsArray[anim]] = await Promise.all([ Scene.root.findFirst(parentNames[anim]) ]); }
//locate the text object in the scene (for debugging) const [thetext] = await Promise.all([ Scene.root.findFirst('text0') ]);
// Get the parent object's children and log their names to the console for (let anim = 0; anim < parentNames.length; anim++) { const children = await parentsArray[anim].findByPath('*'); childArray[anim] = children }
// Enable async/await in JS [part 2]})();
Patches.outputs.getScalar('frameIn').then(event => { event.monitor({}).subscribe(function (values) { // Diagnostics.log("To Script Number ".concat(values.newValue.toString())); let frame = values.newValue totalFrames++
for (let anim = 0; anim < parentNames.length; anim++) { if (childArray[anim] != null) { for (var i = 0; i < childArray[anim].length; i++) { childArray[anim][i].hidden = !(totalFrames % childArray[anim].length == i); } } } });});
// Diagnostics.log(`Child ${i} name: ${children[i].name}`);