-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.html
183 lines (162 loc) · 6.87 KB
/
index.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html>
<head>
<title>LED Strip Effects generator</title>
<meta name="description" content="Create Arduino sketches on the fly with all the effects.">
<meta name="keywords" content="ws2812, effects generator, online, led strip, arduino, teensy">
<meta charset="UTF-8">
<meta name="author" content="Adriano Petrucci">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/form.css?v=1" />
<link rel="stylesheet" href="css/leds.css" />
<script src="scripts/form_slider.js" ></script>
<script src="scripts/form.js" ></script>
<script src="scripts/effects.js" ></script>
<script src="scripts/loops.js" ></script>
<script src="scripts/strip.js" ></script>
<script src="scripts/arduino.js" ></script>
<script src="scripts/tools.js" ></script>
<link rel="stylesheet" href="css/arduino-light.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<script src="scripts/highlight.pack.js"></script>
<script>
let props = {
angle : 90,
color : '#fff'
};
function rotate(e) {
var arr = Array.from(e.childNodes).filter(e => e.className == 'arrow');
arr[0].style.color = props.color;
arr[0].style.transform = `rotate(${props.angle}deg)`;
arr[0].style.transition = 'all 0.2s linear';
props.angle = (props.angle == 0) ? 90 : 0;
props.color = (props.color == '#2a2ac9') ? '#fff' : '#2a2ac9';
}
function change(e) {
document.getElementsByClassName('sidenav-list-item')[1].id = 'active';
var ledstripsdiv = document.getElementById('ledstripsdiv');
for (let i = 0; i < ledstripsdiv.childElementCount; i++) {
ledstripsdiv.childNodes[i].style.background = 'rgb(233,233,233)';
}
e.style.background = 'rgb(100,100,100)';
}
var interval = null;
function addLedStrip(ledStrip) {
if (!ledStrip || typeof ledStrip === 'undefined'){
ledStrip = LedStrips.AddLedStrip();
}
document.getElementById('ledstripsdiv').appendChild(ledStrip.GetDiv());
document.getElementById("ledeffectsdiv").style.paddingTop = parseInt(document.getElementById("ledeffectsdiv").style.paddingTop) + 30 + "px";
document.getElementById("ledeffectsdiv").style.display = "block";
document.getElementById('effects').style.display = "block";
document.getElementsByClassName('sidenav-list-item')[0].id = 'active';
}
var start = window.performance.now();
function loop() {
LedStrips.Loop();
}
interval = window.setInterval(function () { loop(); }, 0);
</script>
</head>
<body onload="charge()">
<div class="grid-container">
<header class="header">
<div class="expand-container" >
<div class="expandable" onclick="expand(this)">
<div class="menu-icon"></div>
<div class="menu-icon"></div>
<div class="menu-icon"></div>
</div>
</div>
<h1 class="title">LED Strip Effects Generator</h1>
<p class="subtitle">
Create your animation for the Neopixel LED Strip and press "Generate Arduino Code" to get it as code.
</p>
</header>
<aside class="sidenav">
<div class="sidenav-data">
<div
title="If the browser is too slow, the animation on the led strip is much faster. The Speed factor shows how much faster the led strip will be.">
<p>Speed factor: <em id='info_speedfactor'>1x</em> </p>
<p>Current: <em id='info_current'>0A (max: 0A)</em> </p>
<p>RAM: <em id='info_ram'>0 bytes</em> </p>
<p>Flash: <em id='info_ram'>4.4 kb</em> </p>
</div>
</div>
<ul class="sidenav-list">
<li class="add-led"><input type="button" id="add" class="btn-add-strip" onclick="addLedStrip();"
value="Add Led Strip" /></li>
<li class="sidenav-list-item">
<p>Effects</p>
</li>
<div class="panel active" id="effects">
<div id="ledeffectsdiv"></div>
</div>
<li class="sidenav-list-item" id="li">
<p>Strip Settings</p>
</li>
<div class="panel" id="strip">
<p id="message">Please select a LED strip to access the settings.</p>
</div>
<li class="sidenav-list-item">
<p onclick="Tools.ImportCode()">Import </p>
</li>
<div id="importDiv"></div>
<li class="sidenav-list-item">
<p onclick="Tools.ExportCode()">Export </p>
</li>
<div id="exportDiv"></div>
<li class="sidenav-list-item">
<p class="emphasis" onclick="Arduino.GenerateCode()">Generate Arduino Code </p>
</li>
<div id="arduCodeDiv"></div>
<li class="sidenav-list-item">
<div id="header" onclick="rotate(this)">
<p>About</p>
<p class="arrow">▼</p>
</div>
</li>
<div id="aboutDiv">
<div>
The source code and documentation are hosted on GitHub:<br>
<a
href="https://github.com/Adrianotiger/Neopixel-Effect-Generator">https://github.com/Adrianotiger/Neopixel-Effect-Generator</a>
<br><br>
Want to discuss about this led strip project? Post your question on the Ardiuno forum:<br>
<a
href="https://forum.arduino.cc/index.php?topic=534060.0">https://forum.arduino.cc/index.php?topic=534060.0</a>
</div>
</div>
</ul>
</aside>
<main class="main">
<div id="ledstripsdiv"></div>
<div id="test"></div>
</main>
<footer class="footer">
<p class="unselectable">Version 3.0 <br> © 2018-2019 <br> <a href='https://github.com/adrianotiger'>Adriano</a>, <a href='https://github.com/jmmzzei'>jmmzzei</a></p>
</footer>
</div>
<script>
function charge() {
if (window.innerWidth > 500) {
document.getElementsByClassName('expand-container')[0].style.display = 'none';
}
var sli = document.getElementsByClassName("sidenav-list-item");
for (let i = 0; i < sli.length; i++) {
sli[i].addEventListener("click", function () {
this.id = (this.id == 'active') ? 'notactive' : 'active';
let panel = this.nextElementSibling;
panel.style.display = panel.style.display == "block" ? "none" : "block";
});
}
}
function expand(e) {
var sidenav = document.getElementsByClassName('sidenav')[0];
sidenav.id = (sidenav.id == 'show') ? 'noshow' : 'show';
}
</script>
</div>
</body>
</html>