Jump to content

Drawing UnFilled Circle with easeljs


sandudhate
 Share

Recommended Posts

Use the Graphics class, set a strokestyle (thickness of the line among other properties), set a line color, and draw the circle.

 

var g = new createjs.Graphics();g.setStrokeStyle(1);g.beginStroke("#000000");g.drawCircle(0,0,30);

That's it.

Here's a link to the official docs for more details:

http://www.createjs.com/docs/easeljs/classes/Graphics.html

Link to comment
Share on other sites

Thanks dimumurray.

It helps a lot. I have another question. When you draw only with beginStroke a circle, i can't use getObjectUnderPoint properly.

e.g. I used

mp = new createjs.Shape(); mp.graphics.setStrokeStyle(12).beginStroke("#00bb00")drawCircle(57,146,32);

stage.addChild(mp);

stage.removeChild(stage.getObjectUnderPoint(57,146));

stage.update();

I also changed params of getObjectUnderPoint but nothing works. Also, mp.x and mp.y both are returning 0. But, I need to remove them. And one more thing, beginFill works properly.

Thanks,

Sankarshan

Link to comment
Share on other sites

I'm speculating here but I suspect that when a circle is drawn without a fill its hit area is limited to the line defined by its stroke. 
An old school (flash) trick is to apply a fill whose alpha is zero. So you might try something like this:

var g = new createjs.Graphics();g.setStrokeStyle(1);g.beginStroke("#000000");g.beginFill("rgba(0,0,0,0)");g.drawCircle(0,0,30);g.endFill();
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...