• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Line width for .bezierCurveTo

New Here ,
Jul 10, 2017 Jul 10, 2017

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

Views

340

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 10, 2017 Jul 10, 2017

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);

Votes

Translate

Translate
LEGEND ,
Jul 10, 2017 Jul 10, 2017

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2017 Jul 10, 2017

Copy link to clipboard

Copied

Thank you, Colin!

It worked GREAT. Still a work in progress, but you can see results here.

Best,

Leo

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 10, 2017 Jul 10, 2017

Copy link to clipboard

Copied

LATEST

Looks nice. It was something new to me too, so I learned something!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines