這裏是我的jsfiddle:jsfiddle希望我的畫布上畫了一個圈,但導致蝕
我想不通爲什麼這個代碼導致偏食,請大家看看下面我的代碼,這是一個動畫使用。
function circleGraph(radius) {
return {
type: 'circle',
radius: radius,
currentAngleAnimate: 0
}
}
$(document).ready(function() {
var canvas = document.getElementById('mycanvas');
var context = canvas.getContext('2d')
var width = canvas.width;
var height = canvas.height;
var circleObj = circleGraph(50);
context.lineWidth = 1;
context.strokeStyle = '#ad2323';
context.fillStyle = '#ad2323';
var draw = function() {
context.clearRect(0, 0, width, height);
context.beginPath();
circleObj.currentAngleAnimate += Math.PI * 2/60;
context.arc(width/2, height/2, circleObj.radius, -Math.PI/2, circleObj.currentAngleAnimate, false);
context.stroke();
context.lineTo(width/2, height/2);
context.fill();
requestAnimationFrame(draw)
}
requestAnimationFrame(draw);
});
正確的,但你的回答是不恰當的。這個問題之前已經有很多次被問及過。請勿嘗試將提問者指向許多重複問答中的一個,而不是添加到一堆重複的問答中。考慮刪除你的答案以支持其中一個問答。 – markE
@markE很好,你找到了重複!但是,請不要讓其他用戶刪除他們的答案而離開居高臨下的評論。歡迎您在此與社區討論您的個人觀點:http://meta.stackoverflow.com/questions/253735/is-it-wrong-to-downvote-a-good-answer-to-a-duplicate-question和http://meta.stackoverflow.com/questions/252009/should-there-be-a-deterrent-for-answering-obvious-duplicate-questions –
這當然不是一個個人的觀點,明顯重複問答應避免按順序保持Stackoverflow不那麼混亂。這是一個政策,不發佈重複的答案 - 因此「關閉:重複......」的能力。順便說一句,我的態度更令人沮喪,而不是居高臨下。與個人無關。 : - // – markE