Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Delay annotate or annotationGroup from running #62

Open
TedGoas opened this issue Apr 11, 2021 · 1 comment
Open

Question: Delay annotate or annotationGroup from running #62

TedGoas opened this issue Apr 11, 2021 · 1 comment

Comments

@TedGoas
Copy link

TedGoas commented Apr 11, 2021

Hey thanks again for making this!

I'm a JS novice and am wondering how to delay an annotate or annotationGroup group from running for 500ms or 1s or something. Is this an option in ag.show();? Or should we be using setTimeout() or something similar?

Any suggestions would be a big help. Thanks!

@TedGoas
Copy link
Author

TedGoas commented Apr 13, 2021

I was able to achieve this by wrapping everything in a setTimeout function. I'm sure there's a better way to do this, but this achieves what I was looking for:

 setTimeout(function () {
    const annotate = RoughNotation.annotate;
    const annotationGroup = RoughNotation.annotationGroup;
    const $ = (t) => document.querySelector(t);
    {
        const a1 = annotate($('.box-blue'), { type: 'box', color: '#3BC9DB', animationDuration: 500 });
        const a2 = annotate($('.box-green'), { type: 'box', color: '#059669', animationDuration: 500 });
        const ag = annotationGroup([a1, a2]);
        ag.show();
    }
}, 500)();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant