Line 40: | Line 40: | ||
var t5 = 0; | var t5 = 0; | ||
var base_t5 = base_t4 + during; | var base_t5 = base_t4 + during; | ||
+ | |||
+ | function redraw() { | ||
+ | ctx.clearRect(0, 0, width, height); | ||
+ | |||
+ | var i = 0; | ||
+ | ctx.beginPath(); | ||
+ | var x = 200 * Math.cos(0 * 180 * 2) + basex; | ||
+ | var y = 100 * Math.sin(0 * 180 * 4) + basey; | ||
+ | ctx.moveTo(x, y); | ||
+ | for (i = 0; i < 0.05; i += 0.00001) { | ||
+ | var x = 200 * Math.cos(i * 180 * 2) + basex; | ||
+ | var y = 100 * Math.sin(i * 180 * 4) + basey; | ||
+ | ctx.lineTo(x, y); | ||
+ | } | ||
+ | ctx.stroke(); | ||
+ | ctx.closePath(); | ||
+ | |||
+ | } | ||
function draw(x, y, r) { | function draw(x, y, r) { | ||
Line 83: | Line 101: | ||
console.log("finish"); | console.log("finish"); | ||
var timer = setInterval(function () { | var timer = setInterval(function () { | ||
− | + | redraw(); | |
− | + | ||
i += 0.00001; | i += 0.00001; | ||
Line 139: | Line 156: | ||
rect.x2 = drawWidth + rect.x; | rect.x2 = drawWidth + rect.x; | ||
rect.y2 = drawHeight + rect.y; | rect.y2 = drawHeight + rect.y; | ||
− | if(rect.x < x) | + | if (rect.x < x) |
− | if(rect.x2 > x) | + | if (rect.x2 > x) |
− | if(rect.y < y) | + | if (rect.y < y) |
− | if(rect.y2 > y) | + | if (rect.y2 > y) |
return true; | return true; | ||
return false; | return false; | ||
Line 174: | Line 191: | ||
</script> | </script> | ||
+ | |||
<hr> | <hr> | ||
<div class="text-center"> | <div class="text-center"> |
Revision as of 14:10, 16 October 2018