javascript - Canvas - Path looks like zoomed in -


i created bezier path on canvas. although canvas wide enough path not fit it. looks if path zoomed in. wrong? jsfiddle

js

var canvas, context;  init();  function init() {   canvas = document.getelementbyid("mycanvas");   context = canvas.getcontext("2d");    context.fillstyle = 'rgb(245,245,245)'; context.fillrect( 0, 0, 420, 256 );  context.beginpath(); context.moveto(10, 70);  context.beziercurveto(160, 50, 240, 50, 400, 50); context.linewidth=4; context.stroke();  } 

you need declare width , height attributes on canvas element. right have canvas of default size, scaled css, that's why looks zoomed.

<canvas width="440" height="256" ></canvas> 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -