html5 canvas - EaselJS: Changing a Shape Objects Dimensions -
html5 canvas - EaselJS: Changing a Shape Objects Dimensions -
total noob question. i've been abusing google , reason, have surprisingly not been able find regarding this...? sense i'm missing here. :p
i have resize() function modifies canvas dimensions size of window. in minimal illustration (which uses jquery), have variable references shape object. according documents, shape object not include width & height property. efficient way of resizing shape object? removing/redrawing dynamically?
this have:
var stage; var bgcolor; $(document).ready(function(){ init(); }); function init() { stage = new createjs.stage("canvasstage"); bgcolor = new createjs.shape(); bgcolor.graphics.beginfill("#000000").drawrect(0,0, stage.canvas.width, stage.canvas.width); stage.addchild(bgcolor); $(window).resize(function(){windowresize();}); windowresize(); } function windowresize() { stage.canvas.width = $(window).width(); stage.canvas.height = $(window).height(); //bgcolor.width = $(window).height();// no width property //bgcolor.height = $(window).height();// no height property stage.update();}
you can utilize shape's scalex , scaley scale shape.
note: shape object extends displayobject might want @ displayobject docs many more useful properties/methods.
myshape.scalex=1.2; myshape.scaley=1.2;
html5-canvas easeljs createjs
Comments
Post a Comment