-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
79 lines (67 loc) · 2.27 KB
/
main.go
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// English:
//
// This example was taken from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fy
//
// Português:
//
// Este exemplo foi retirado do site https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fy
//
// <svg viewBox="0 0 480 200" xmlns="http://www.w3.org/2000/svg">
// <defs>
// <radialGradient id="gradient1" cx="0.5" cy="0.5" r="0.5"
// fx="0.35" fy="0.35" fr="5%">
// <stop offset="0%" stop-color="white"/>
// <stop offset="100%" stop-color="darkseagreen"/>
// </radialGradient>
// <radialGradient id="gradient2" cx="0.5" cy="0.5" r="0.5"
// fx="0.35" fy="0.75" fr="5%">
// <stop offset="0%" stop-color="white"/>
// <stop offset="100%" stop-color="darkseagreen"/>
// </radialGradient>
// </defs>
//
// <circle cx="100" cy="100" r="100" fill="url(#gradient1)" />
// <circle cx="100" cy="100" r="100" fill="url(#gradient2)" style="transform: translateX(240px);" />
// </svg>
//go:build js
// +build js
package main
import (
"github.com/helmutkemper/iotmaker.webassembly/browser/factoryBrowser"
"github.com/helmutkemper/iotmaker.webassembly/platform/factoryColor"
)
func main() {
done := make(chan struct{}, 0)
stage := factoryBrowser.NewStage()
s1 := factoryBrowser.NewTagSvg().ViewBox([]float64{0, 0, 480, 200}).Append(
factoryBrowser.NewTagSvgDefs().Append(
factoryBrowser.NewTagSvgRadialGradient().Id("gradient1").Cx(0.5).Cy(0.5).R(0.5).Fx(0.35).Fy(0.35).Fr(float32(0.05)).Append(
factoryBrowser.NewTagSvgStop().Offset(float32(0.0)).StopColor(factoryColor.NewWhite()),
factoryBrowser.NewTagSvgStop().Offset(float32(1.0)).StopColor(factoryColor.NewDarkseagreen()),
),
factoryBrowser.NewTagSvgRadialGradient().Id("gradient2").Cx(0.5).Cy(0.5).R(0.5).Fx(0.35).Fy(0.75).Fr(float32(0.05)).Append(
factoryBrowser.NewTagSvgStop().Offset(float32(0.0)).StopColor(factoryColor.NewWhite()),
factoryBrowser.NewTagSvgStop().Offset(float32(1.0)).StopColor(factoryColor.NewDarkseagreen()),
),
),
factoryBrowser.NewTagSvgCircle().Cx(100).Cy(100).R(100).Fill("url(#gradient1)"),
factoryBrowser.NewTagSvgCircle().Cx(100).Cy(100).R(100).Fill("url(#gradient2)").Style("transform: translateX(240px);"),
)
stage.Append(s1)
<-done
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//