forked from cappelnord/EzSVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example2.lua
50 lines (35 loc) · 954 Bytes
/
example2.lua
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
47
48
49
50
EzSVG = require "EzSVG"
local dim = 500
svg = EzSVG.Document(dim, dim, EzSVG.gray(40))
group = EzSVG.Group()
circles = EzSVG.Group()
svg:add(group)
svg:add(circles)
local num = 800
EzSVG.setStyle({
stroke_linecap= "round",
fill= "white",
stroke= "white"
})
for i=0,num do
local norm = i / num
local length = dim/2.1 * (0.5 + math.abs(math.sin(norm * 80)) * 0.5)
local lw = math.abs(math.sin(norm*200)) * 1
local x = dim/2 + math.sin(norm * 50) * length
local y = dim/2 + math.cos(norm * 50) * length
local line = EzSVG.Line(dim/2, dim/2, x, y, {
stroke_width= lw + 0.3
})
group:add(line)
local circle = EzSVG.Circle(x, y, lw * 15, {
fill= "#000000",
stroke_width = 1
})
circles:add(circle)
end
svg:add(EzSVG.Circle(dim/2, dim/2, 60, {
fill= "black",
stroke= "white",
stroke_width = 5
}))
svg:writeTo("example2.svg")