Famous / Famous/engine

[BUG] Position#set calls not queuing as expected.

Open
#474 4 comments 0 reactions 1 assignee Claimed by @alexanderGugel View on GitHub
bug
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Instead of doing the following

``` js
cardPosition.set(goToPosition[0],goToPosition[1],goToPosition[2]+10, {
duration: 2000,
curve: 'inOutExpo'
})
.set(0,0,0) // move everything back
```

I'm doing

``` js
cardPosition.set(goToPosition[0],goToPosition[1],goToPosition[2]+10, {
duration: 2000,
curve: 'inOutExpo'
}, function() {
// move everything back
cardPosition.set(0,0,0) // <--- IT DOESN'T WORK :(
})
```

The result is that `cardPosition.set(0,0,0)` never takes effect.

It seems like the preceding animation might still place at least one more command into the command queue after the call to `cardPosition.set(0,0,0)`.

In order to make it work, I have to do the following:

``` js
cardPosition.set(goToPosition[0],goToPosition[1],goToPosition[2]+10, {
duration: 2000,
curve: 'inOutExpo'
}, function() {
Engine.requestUpdateOnNextTick({ onUpdate() {
// move everything back
cardPosition.set(0,0,0) // <--- IT WORKS!
}})
})
```

This bug might exist with other components if they're all designed the same way, but I haven't checked.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.