1 Reply Latest reply on Apr 6, 2017 8:43 AM by kglad

    eraser with mouse

    özkanö22025120

      var shape, oldX, oldY, size, color;

      shape = new createjs.Shape();

      stage.on("stagemousemove", function (evt) {

        if (oldX) {

        shape.graphics.beginStroke(color)

        .setStrokeStyle(size, "round")

        .moveTo(oldX, oldY)

        .lineTo(evt.stageX, evt.stageY);

        stage.update();

        }

        oldX = evt.stageX;

        oldY = evt.stageY;

        stage.update();

      })

      stage.on("stagemouseup", function (event) {

        color = createjs.Graphics.getRGB(50, 100, 150, 1);

      });

      stage.on("stagemousedown", function (event) {

        color = createjs.Graphics.getRGB(50, 100, 150, 1);

        size = 4;

      });

      stage.on("stagemouseup", function (event) {

        color = "";

      });

      stage.addChild(shape);

      stage.update();

       

      _______________________________________________________________

       

      My english is not very good soryy.

      I can not delete this code with the mouse, please help me.