Leinwand Klar in Paper.js

Weiß wer, der beste Weg, um klar eine Leinwand mit paper.js
Ich habe versucht, die regelmäßige Leinwand clearing-Methoden, aber Sie scheinen nicht zu arbeiten mit paper.js

Html

<canvas id="myCanvas" style="background:url(images/graphpaper.jpg); background-repeat:no-repeat" height="400px" width="400px;"></canvas>

<button class="btn btn-default button" id="clearcanvas" onClick="clearcanvas();"     type="button">Clear</button>    

Javascript/Paperscript

<script type="text/paperscript" canvas="myCanvas">
//Create a Paper.js Path to draw a line into it:
tool.minDistance = 5;

var path;
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");

function onMouseDown(event) {
//Create a new path and give it a stroke color:
path = new Path();
path.strokeColor = 'red';
path.strokeWidth= 3;
path.opacity="0.4";

//Add a segment to the path where
//you clicked:
path.add(event.point, event.point);
}

function onMouseDrag(event) {
//Every drag event, add a segment
//to the path at the position of the mouse:
path.add(event.point, event.point);

}


</script>
InformationsquelleAutor craig | 2013-09-27
Schreibe einen Kommentar