This has happened in several times to me already, with versions of Famous Engine ranging from 0.5 to 0.7.2, but I'm not at all sure what I have to do prior in order to experience the problem. I have some code like this:
js
...
this._positionTransitionable = new Transitionable(0)
this._positionTransitionable.set(200, {duration: 600, curve: 'easeOut'})
let self = this
console.log('node?', node) // node exists, and is a Node
self._goForwardAnimation = node.addComponent({
onUpdate() {
console.log('animating forward') // never fires
if (self._positionTransitionable.isActive()) {
let position = node.getPosition()
node.setPosition(position[0], position[1], self._positionTransitionable.get())
node.requestUpdateOnNextTick(self._goForwardAnimation)
}
else { // clean up.
console.log('Getting rid of the component.')
node.removeComponent(self._goForwardAnimation)
}
}
})
node.requestUpdateOnNextTick(self._goForwardAnimation)
...
The expected behavior is that the _goForwardAnimation will start updating after being started with node.requestUpdateOnNextTick, but it doesn't happen. The console.log inside the component never fires.
该提问来源于开源项目:Famous/engine

