Skip to content

Animations not queuing #123

@jsfi

Description

@jsfi

Each element has its own animation queue. Animations are queued when Element.animate is called multiple times at once with the same element. The animations will occur in order, and the first animation will occur immediately.

If I call element.animate multiple times, only one animation is executed with the united values of all animations and the duration of the last animation.

var UI = require('ui');
var Vector2 = require('vector2');

var w = new UI.Window();

var rect = new UI.Rect({
    position: new Vector2(0,0),
    size: new Vector2(10, 10)
});

w.add(rect);
w.show();

rect.animate({ size: new Vector2(10,152), easing: 'linear' }, 2000);
rect.animate({ size: new Vector2(144,152), easing: 'linear' }, 4000);

In my opinion the problem is the if-case in ui/element.js:86. When calling only element.animate multiple times the element._queue will always be empty and animate.call(this); is executed every time.

I want to ask if the error is in the documentation or my understanding of it before suggesting a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions