Copy link to clipboard
Copied
Hello,
I am using the HTML5 Canvas code snippets to create a few bezier curves. Everything works fine (see project here), but I need to change the line thickness, and cannot find how to enter a line width parameter on the .bezierCurveTo. Here is a sample script that I am using for each curve:
var shape = new createjs.Shape(new createjs.Graphics().beginStroke(“#000000”).moveTo(X1,Y1).bezierCurveTo(X2,Y2,X3,Y3,X4,Y4).endStroke());
this.addChild(shape);
Help!
Leo
It appears to be setStrokeStyle(). If you break your lines up a bit it will be easier to set:
var g = new createjs.Graphics();
g.setStrokeStyle(3); // for example, 3 pixel line width
g.beginStroke("#000000").moveTo(X1,Y1).bezierCurveTo(X2,Y2,X3,Y3,X4,Y4).endStroke());
var shape = new createjs.Shape(g);
this.addChild(shape);
Copy link to clipboard
Copied
It appears to be setStrokeStyle(). If you break your lines up a bit it will be easier to set:
var g = new createjs.Graphics();
g.setStrokeStyle(3); // for example, 3 pixel line width
g.beginStroke("#000000").moveTo(X1,Y1).bezierCurveTo(X2,Y2,X3,Y3,X4,Y4).endStroke());
var shape = new createjs.Shape(g);
this.addChild(shape);
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Looks nice. It was something new to me too, so I learned something!