rough-notation
rough-notation copied to clipboard
Question: Delay annotate or annotationGroup from running
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!
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)();