Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Correct way to use mojs with promise/async? #221

Copy link
Copy link
@uduse

Description

@uduse
Issue body actions

I want to play an animation and wait until it finishes. I checked the docs and tutorials and I did not find an API that returns a promise or something.

It seems there's no related discussion here so I would like it to ask if there's a standard way of doing this?

What I am doing now is wrapping it in a promise and it works fine:

const burstPromise = new Promise(resolve => {
    const burst = new mojs.Burst({
        radius: {30: 120},
        count: 10,
        children: {
            duration: 3000,
        },
        onComplete() {
            resolve();
        }
    });
    burst.play();
});

await burstPromise;

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurefeature request to implementfeature request to implement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.