-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (38 loc) · 1.49 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
// English:
//
// This example was taken from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/keyTimes
//
// Português:
//
// Este exemplo foi retirado do site https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/keyTimes
//
// <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
// <circle cx="60" cy="10" r="10">
// <animate attributeName="cx" dur="4s" repeatCount="indefinite"
// values="60; 110; 60; 10; 60" keyTimes="0; 0.25; 0.5; 0.75; 1"/>
// <animate attributeName="cy" dur="4s" repeatCount="indefinite"
// values="10; 60; 110; 60; 10" keyTimes="0; 0.25; 0.5; 0.75; 1"/>
// </circle>
// </svg>
//go:build js
// +build js
package main
import (
"github.com/helmutkemper/iotmaker.webassembly/browser/factoryBrowser"
"github.com/helmutkemper/iotmaker.webassembly/browser/html"
"time"
)
func main() {
done := make(chan struct{}, 0)
stage := factoryBrowser.NewStage()
s1 := factoryBrowser.NewTagSvg().ViewBox([]float64{0, 0, 120, 120}).Append(
factoryBrowser.NewTagSvgCircle().Cx(60).Cy(10).R(10).Append(
factoryBrowser.NewTagSvgAnimate().AttributeName("cx").Dur(4*time.Second).RepeatCount(html.KSvgDurIndefinite).
Values([]float64{60, 110, 60, 10, 60}).KeyTimes([]float64{0, 0.25, 0.5, 0.75, 1}),
factoryBrowser.NewTagSvgAnimate().AttributeName("cy").Dur(4*time.Second).RepeatCount(html.KSvgDurIndefinite).
Values([]float64{10, 60, 110, 60, 10}).KeyTimes([]float64{0, 0.25, 0.5, 0.75, 1}),
),
)
stage.Append(s1)
<-done
}