We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I want to run an animation one time within the draw () loop, while keeping everything else running _forever. I've set var flag to 0 in setup (). Ideally, if animationOne overlaps circle, then it should run a sequence, then stop. The problem is that (I think) the code is running too fast, it gets to flag = 1 before it has a chance to run animationOne.changeAnimation('round');
What's the best way to accomplish this? Thanks in advance.
function draw() {
if(animationOne.overlap(circle) && flag == 0){
animationOne.changeAnimation('round');
flag = 1;
}
else
animationOne.changeAnimation('normal');
Answers
Hello @Sophi
Do you have the code to get more help about your question?
hi @laimperiestro!
I will add some more the code here :) What I intend is within the draw function, for the "if" expression to be evaluated as true and continue to run the line
animationOne.changeAnimation('round');
then set the flag value to 1. The trouble is that the code seems to skip running the functionanimationOne.changeAnimation('round');
and change flag to 1 beforehand. Any help with a solution to this would be appreciated!Here is the full code: