Does anyone know how to do the following things sequentially on an HTML5 canvas (using javascript).
- Text appears (I already know how to do this :P)
- Text flashes several times at one second intervals
- Text disappears after 5 seconds (or whenever)
The reason I find this so hard to do, is because there is no way to create a pause in a script. Any help would be greatly appreciated!
Does anyone know how to do the following things sequentially on an HTML5 canvas (using javascript).
- Text appears (I already know how to do this :P)
- Text flashes several times at one second intervals
- Text disappears after 5 seconds (or whenever)
The reason I find this so hard to do, is because there is no way to create a pause in a script. Any help would be greatly appreciated!
Share edited Aug 7, 2017 at 19:09 Rob 5,2955 gold badges42 silver badges63 bronze badges asked Jan 16, 2012 at 6:56 rshea0rshea0 12.3k9 gold badges30 silver badges41 bronze badges1 Answer
Reset to default 7function flashyText() {
var count = 10,
timer = setInterval(function() {
count--;
if( count%2 == 1) {
// draw the text
}
else {
// don't draw it (ie. clear it off)
}
if( count == 0) clearInterval(timer);
},1000);
}
Something like that.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744933154a4601858.html
评论列表(0条)