-
Notifications
You must be signed in to change notification settings - Fork 0
/
documentation.html
144 lines (136 loc) · 6.4 KB
/
documentation.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<html>
<head>
<title>SpriteMeister Documentation</title>
<script src="console.js"></script>
<script src="element.js"></script>
<style>
body {
font: 16px Arial;
}
h3 {
border-top: 1px solid grey;
padding-top: 1em;
}
sprite-meister {
margin-left: 5em;
}
</style>
</head>
<body>
<!-- <sprite-meister id="bounce" duration="1s" steps="24" w="300" width="400px" height="100px" a1="blue">
${setv1(minmax({value:0,min:41 - ease({distance:10})}))}
${setv2(ease({distance:35,frames:framecount/2}))}
<ellipse
cx="50"
cy="${70 - v2}"
rx="${ framenr > 11 ? v1 : 30}"
ry="30"
fill="none"
stroke="${a1}"
stroke-width="10"
></ellipse>
<text y="12">${v2} Frame n:${n} of ${framecount}</text>
</sprite-meister> -->
<h1>SpriteMeister Documentation (of the important parts)</h1>
<h2>SpriteMeister attributes</h2>
<ul>
<li>duration : duration for all frames, in seconds notation</li>
<li>paths : show colored points for every frame calculation</li>
<li>width : set width, other than 100px default width</li>
<li>cell : define SVG viewBox size</li>
<li>background-color : set background-color</li>
</ul>
<h2>SpriteMeister variables</h2>
<ul>
<li>n : framenumber</li>
<li>w : current sprite width</li>
<li>h : current sprite height</li>
</ul>
<h2>SpriteMeister functions</h2>
Can be used inside Template Literals Strings to calculate values for each frame.
<h3>attr( name , defaultValue ) - Returns attribute value from <code><sprite-meister></code> or template</h3>
<h3>round({ value, precision = 0 }) - Returns rounded value by precision</h3>
<h3>pulse: ({ start:10, mid:50, [end = start] }) - Returns a value on a linear path, to end and back to start</h3>
<sprite-meister id="pulse" duration="10s" paths width="200px" playstate="paused" background-color="beige">
${setv1(pulse({start:10,mid:80}),"pulse from start to end ")}
<text x="5" y="${v1}" font-size="10px">frame:${n} v1:${v1} </text>
<circle cx="${90}" cy="${v1}" r="5"></circle>
</sprite-meister>
<h3>
ease: ({ distance, [frames = this.steps / 2], [delay = q1] }) - Returns a value on a <b>easing</b> path, 0 to
distance and back to 0
</h3>
<sprite-meister id="pulse" duration="10s" paths width="200px" playstate="paused" background-color="beige">
${setv1(100-ease({distance:80}),"")}
<text x="5" y="${v1}" font-size="10px">frame:${n} v1:${int(v1)} </text>
<circle cx="${90}" cy="${v1}" r="5"></circle>
</sprite-meister>
<h3>
scale: ({ start:1, mid:5, [end = start], [center = 50] }) - Returns a pulsating SVG matrix definition for scaling
SVG groups
</h3>
<sprite-meister id="pulse" duration="10s" paths width="200px" playstate="paused" background-color="beige">
${setv2(scale({start:1,mid:5}),"")}
<g transform="${v2}">
<circle cx="50" cy="50" r="5" fill="blue"></circle>
<rect x="40" y="47" width="10" height="5" fill="green"></rect>
</g>
<text x="1" y="${v1}" font-size="6px">${v2} </text>
</sprite-meister>
<h3>circlepath({ radius:n}} - Returns object {x,y} for each frame</h3>
<sprite-meister id="circle" duration="10s" paths width="200px" playstate="paused" background-color="beige">
${setv1(circlepath({radius1:25}),"calc x,y circle mottion for every frame")}
<circle cx="${v1.x}" cy="${v1.y}" r="5"></circle>
<text x="20px" y="50%" font-size="10px">x:${v1.x} y:${v1.y}</text>
</sprite-meister>
<h3>arcpath({ start:[x,y] , end:[x,y] , control:[dx,dy] }} - Returns object {x,y} for each frame</h3>
<sprite-meister id="arcs" duration="10s" paths cell1="250x250" width="200px" background-color="beige">
${setv1(arcpath({start:[5,15],end:[95,95],control:[50,-50],c2:[50,20,40,150]}))}
<circle cx="${v1.x}" cy="${v1.y}" r="5"></circle>
<text y="12" font-size="10px">n:${framenr} x:${v1.x} y:${v1.y}</text>
</sprite-meister>
<!-- <sprite-meister id="SVGlogo" duration="1s" paths steps="1" h="300" w="300">
<g stroke="#000" stroke-width="38">
<g id="b" transform="rotate(35 150 150) translate(150 150)">
<path id="a" fill="#ffb13b" d="m-84-16a22 22 0 100 32h168a22 22 0 100-32z" />
<use x="0" href="#a" transform="rotate(45)" />
<use href="#a" transform="rotate(90)" />
<use href="#a" transform="rotate(135)" />
</g>
</g>
<use href="#b" />
<path opacity=".6" fill="#000" d="M9 150h283v100c0 24-18 42-42 42H50c-23 0-41-18-41-42Z" />
<path
fill="white"
d="M5 31A18 18 0 0 1 18 0c11 0 19 8 19 18H26a8 8 0 1 0-13 6l5 2c6 0 10 2 13 5a18 18 0 0 1-13 32C8 63 0 54 0 44h11a8 8 0 1 0 13-5l-6-2c-4-1-9-2-13-6ZM73 0 60 63H50L37 0h11l7 37 8-37h10ZM92 26h18v18a18 18 0 0 1-37 0V18a18 18 0 0 1 37 0H99a8 8 0 0 0-15 0v26a8 8 0 0 0 15 0v-7h-7V26Z"
transform="matrix(2 0 0 2 40 158)"
/>
</sprite-meister> -->
<!-- <sprite-meister spritemeister id="hamarrow2" duration="4s">
<g stroke="lightcoral" stroke-width="8" stroke-linecap="round">
<path d="M15 30L85 30"></path>
<path d="M15 50L85 50"></path>
<path d="M85 70L15 70"></path>
</g>
<g stroke="green" stroke-width="8" stroke-linecap="round">
<path d="M50 70L20 50"></path>
<path d="M75 50L20 50"></path>
<path d="M50 30L20 50"></path>
</g>
${setv1(arcpath({start:[15,30],end:[50,30],control:[40,15],color:3}))}
${setv2(arcpath({start:[85,30],end:[20,50],control:[85,60,20,80],color:4}))}
${setv3(arcpath({start:[15,50],end:[75,50],control:[50,20],color:1}))}
${setv4(arcpath({start:[85,50],end:[20,50],control:[50,70],color:2}))}
${setv5(arcpath({start:[85,70],end:[20,50],control:[30,90],color:5}))}
${setv6(arcpath({start:[15,70],end:[50,70],control:[40,40],color:6}))}
<g stroke="black" stroke-width="8" stroke-linecap="round">
<path d="M${v1.x} ${v1.y}L${v2.x} ${v2.y}"></path>
<path d="M${v3.x} ${v3.y}L${v4.x} ${v4.y}"></path>
<path d="M${v5.x} ${v5.y}L${v6.x} ${v6.y}"></path>
</g>
</sprite-meister> -->
<!--
<sprite-animation src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/57786/dog-walk.svg" steps="1x9" duration=".05s" background="magenta">
</sprite-animation> -->
</body>
</html>