Search code examples
createjseaseljs

Draw a RoundRect in easeljs


How to draw a rectangle in easeljs with only two rounded corners. I am doing this to get rounded corners in the bottom:

layout.graphics.beginStroke("black").drawRoundRect(100,100,100,100,0,0,5,5);

This is not drawing any rounded corners. Only this seems to be working:

layout.graphics.beginStroke("black").drawRoundRect(100,100,100,100,5);

Solution

  • Look into the drawRoundRectComplex method, instead of drawRoundRect: http://createjs.com/docs/easeljs/classes/Graphics.html#method_drawRoundRectComplex

    drawRoundRectComplex(x, y, w, h, radiusTL, radiusTR, radiusBR, radiusBL);
    

    Hope that helps.