0 Replies Latest reply on Feb 11, 2016 5:41 AM by Lachlan D

    CreateJS/Canvas line and changable stroke thickness

    Lachlan D Level 1

      I'm looking for a way to draw a line that changes thickness, so a line which is being drawn on,  and updated on tick (mouse move or animating point)

      The idea being the user can paint a line that gets thinner over time.

       

       

      //Init

              var line = new createjs.Shape();

              line.graphics.setStrokeStyle(_thickness);

              line.graphics.beginStroke("#ffffff");

              line.graphics.moveTo(_startX ,  _startY);

              stage.addChild(line);

       

      //Later on tick()

      // This line I think is the problem

      line.setStrokeStyle(_thickness)

       

      line.graphics.lineTo( _newX , _newY);

      _thickness--;