我使用普通的javascript将图像添加到画布,这是代码
var canvas = document.getElementById('canvas');
context = canvas.getContext('2d');
canvas_image();
function canvas_image(){
can_img = new Image();
can_img.src = 'Chrysanthemum.jpg';
can_img.onload = function(){
context.drawImage(can_img, 100, 100);
}
}
Run Code Online (Sandbox Code Playgroud)
如何使用paperJS库将图像添加到画布?
如何将svg元素(rect,circle等)放在html上.这是我的编码.有谁可以帮忙.
<div id="myImgId" style="width: 200px; height: 200px; background:#000;" onmousedown="doSomething()" onmouseup="return false;">
<img src="Chrysanthemum.jpg" width="200" height="200" />
<svg id="svgOne" y="200" width="200" height="200"></svg>
</div>
Run Code Online (Sandbox Code Playgroud) 我试图在线的尖端画一条带箭头的线.但我无法完成它.谁能帮我.
我尝试用线条添加三角形但不幸的是它在动态绘制时不起作用.这就是我和线路一起尝试的.
var myPath;
function onMouseDown(event) {
myPath = new Path();
myPath.strokeColor = 'black';
}
function onMouseDrag(event) {
myPath.add(event.point);
}
function onMouseUp(event) {
var myCircle = new Path.RegularPolygon(event.point, 3, 10);
myCircle.strokeColor = 'black';
myCircle.fillColor = 'white';
}
Run Code Online (Sandbox Code Playgroud)