Не работает код Canvas на HTML (это уже другая программа)
Вложений: 1
СРОЧНОООООО
не работает код канвас на хтмл. прилагаю скрин тоже </head> <body> <canvas id="canvas" width="300" height="300"></canvas> <script type="text/javascript"> var circle = function (x, y, radius) { ctx.beginPath(); ctx.arc(x, y, radius, 0, Math.Pl * 2, false); ctx.stroke(); }; ctx.lineWidth = 4; ctx.strokeStyle = "Red"; circle(100, 100, 10); ctx.strokeStyle = "Orange"; circle(100, 100, 20); ctx.strokeStyle = "Yellow"; circle(100, 100, 30); ctx.strokeStyle = "Green"; circle(100, 100, 40); ctx.strokeStyle = "Blue"; circle(100, 100, 50); ctx.strokeStyle = "Purple"; circle(100, 100, 60); </script> хелп |
|
мне это нужно просто скопировать??
|
flyrixxx1,
где определение ctx? |
Цитата:
<!DOCTYPE html> <html> <head> <title>Canvas</title> </head> <body> <canvas id="canvas" width="300" height="300"></canvas> <script type="text/javascript"> var circle = function (x, y, radius, col) { var ctx = canvas.getContext("2d"); ctx.lineWidth = 4; ctx.strokeStyle = col; ctx.beginPath(); ctx.arc(x, y, radius, 0, Math.Pl * 2, false); ctx.stroke(); } circle(100, 100, 10, "Red"); </script> </body> |
рони,
что я делаю не так?? |
Цитата:
Цитата:
Alexandroppolus пост #2, и посмотрите код |
Цитата:
var ctx = canvas.getContext("2d"); вот определение ctx |
Вложений: 2
вроде нашёл ошибку, случайно написал Pl вместо PI, просто в шрифте хтмл их сложно отличить)
всё работает) |
Цитата:
|
Часовой пояс GMT +3, время: 03:48. |