<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>13使用konva库开发一个矩形title>
<style>
body {
padding: 0;
margin: 0;
background-color: #f0f0f0;
overflow: hidden;
}
style>
<script src="lib/js/konva/konva.js">script>
head>
<body>
<div id="container">
div>
<script>
var stage = new Konva.Stage({
container:'container',
width:window.innerWidth,
height:window.innerHeight
});
var layer = new Konva.Layer();
stage.add(layer);
var rect = new Konva.Rect({
x:100,
y:100,
width:100,
height:100,
fill:'gold',
stroke:'navy',
strkeWidth:4,
opacity:.2,
scale:1.2,
rotation:30,
cornerRadius:10,
draggable:true
});
layer.add(rect);
layer.draw();
script>
body>
html>
![使用konva库开发一个矩形_第1张图片](http://img.e-com-net.com/image/info8/ddc3fc5c909f4250b3539cdacb316c43.jpg)