-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSVG_example.html
38 lines (38 loc) · 1.01 KB
/
SVG_example.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
<!DOCTYPE html>
<html>
<head>
<title>SVG.js</title>
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js@3.0/dist/svg.min.js"></script>
</head>
<body>
<script>
SVG.on(document, "DOMContentLoaded", function () {
let draw = SVG().addTo("body").size(600, 600);
let rect1 = draw.rect(100, 100).attr({ fill: "red" });
rect1.transform({
rotate: 125,
translateX: 5,
translateY: 1,
scale: 1,
origin: { x: 50, y: 50 },
});
let rect2 = draw.rect(100, 100).attr({ fill: "blue" });
rect2.transform({
rotate: 125,
translateX: 150,
translateY: 1,
scale: 1,
position: { x: 50, y: 50 },
});
let rect3 = draw.rect(100, 100).attr({ fill: "green" });
rect3.transform({
rotate: 125,
translateX: 300,
translateY: 1,
scale: 1,
relative: { x: 50, y: 50 },
});
});
</script>
</body>
</html>