forked from oslego/Snap.FreeTransform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
46 lines (37 loc) · 786 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body, html{
width: 100%;
height: 100%;
margin: 0;
}
svg{
background: gray;
}
</style>
</head>
<body>
<div id="holder"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/snap.svg/0.3.0/snap.svg-min.js"></script>
<script src="snap.freetransform.js"></script>
<script>
var snap = Snap('100%','100%')
var rect = snap.paper.rect(100,100, 400, 200).attr('fill','green')
function cb(){
// console.log(this);
}
Snap.freeTransform(rect, {
draw: ['bbox'],
drag: ['center'],
keepRatio: ['bboxCorners'],
rotate: ['axisX'],
scale: ['bboxCorners', 'bboxSides'],
distance: '0.6'
}, cb);
</script>
</body>
</html>