Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Spark AR Script no iniciará funciones

Tengo un script para un filtro de Instagram Spark AR. Quiero que sea un filtro que... eres tú. Mi problema es que no puedo iniciar el filtro tocando la pantalla. Creo que solo comienza a pasar por el ciclo principal, pero no tengo idea de por qué se detiene. ¿Estoy usando API o funciones antiguas?

Aquí está mi código:

 // Spark AR APIs const Time = require('Time'); const Patches = require('Patches'); const Instruction = require('Instruction'); const Materials = require('Materials'); const Textures = require('Textures') // Objects const display0 = Materials.getAll('display'); const pics = ['pic1', 'pic2', 'pic3']; // Variables let randInterval = null; let status = 'ready'; // Setting Initial Instruction Instruction.bind(true, 'tap_to_start'); // Main loop Patches.outputs.getPulse('tap').then(value => value.subscribe(() => { Instruction.bind(false, 'tap_to_start') if (status === 'ready') { start(); } else if (status === 'running'){ return; } else if (status === 'finished'){ reset(); } })); // Functions function start(){ status = 'running'; randInterval = Time.setInterval(function (){ randomImage(); }, 100); beginCountDown(); }; function beginCountDown(){ Time.setTimeout(function(){ stop(); }, 3000); }; function stop(){ Time.clearInterval(randInterval); Instruction.bind(true, 'tap_to_reply') status = "finished"; }; function reset(){ Instruction.bind(false, 'tap_to_reply') Instruction.bind(true, 'tap_to_start') display0.diffuse = Textures.get('SPARKLE'); status = 'ready'; }; // Logic Functions function randomImage(){ let randomNumber = randomlyChoose(0, pics.length); let pickedImage = pics[randomNumber] display0.diffuse = Textures.get(pickedImage); }; function randomlyChoose(min, max) { return Math.floor(Math.random() * (max - min + 1) + min) };
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!