Здравствуйте, я новичок в js, подскажите пожалуйста, не работает transform, сам setTimeout() работает
Вот сам код:
const Scene = require('Scene');
const Animation = require('Animation');
const TimeModule = require('Time');
var fps = 30;
var speedBackground = 0.007;
const step1 = Scene.root.find("step1");
function random(min,max){
return Math.random() * (max - min) + min;
}
const moveDownDriver = Animation.timeDriver({durationMilliseconds: fps, loopCount:Infinity,mirror: false});
moveDownDriver.onAfterIteration().subscribe(function(){moveBackground()});
function moveBackground(){
step1.transform.y = step1.transform.y.pinLastValue()-speedBackground;
check();
}
function check(){
if(step1.transform.y.pinLastValue()<-0.3){
TimeModule.setTimeout(function(){ step1.transform.y = 0.3},0);
}
}
moveDownDriver.start();
Вот нерабочий кусок:
TimeModule.setTimeout(function(){ step1.transform.y = 0.3},0);