Add files via upload
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
function getPixelRGBValues(base64Image) {
|
function getPixelRGBValues(base64Image) {
|
||||||
httpArray = [];
|
httpArray = [];
|
||||||
fileJSON = JSONledStringStart + document.getElementById('brightnessNumber').value + JSONledStringMid1;
|
fileJSON = JSONledStringStart + document.getElementById('brightnessNumber').value + JSONledStringMid1 + document.getElementById('targetSegment').value + JSONledStringMid2;
|
||||||
|
|
||||||
//const copyJSONledbutton = document.getElementById('copyJSONledbutton');
|
//const copyJSONledbutton = document.getElementById('copyJSONledbutton');
|
||||||
const JSONled = document.getElementById('JSONled');
|
const JSONled = document.getElementById('JSONled');
|
||||||
@@ -258,7 +258,7 @@ function getPixelRGBValues(base64Image) {
|
|||||||
|
|
||||||
//For evry commandString in the array
|
//For evry commandString in the array
|
||||||
for (let i = 0; i < commandArray.length; i++) {
|
for (let i = 0; i < commandArray.length; i++) {
|
||||||
let thisJSONledString = JSONledStringStart + document.getElementById('brightnessNumber').value + JSONledStringMid1 + commandArray[i] + JSONledStringEnd;
|
let thisJSONledString = JSONledStringStart + document.getElementById('brightnessNumber').value + JSONledStringMid1 + document.getElementById('targetSegment').value + JSONledStringMid2 + commandArray[i] + JSONledStringEnd;
|
||||||
httpArray.push(thisJSONledString);
|
httpArray.push(thisJSONledString);
|
||||||
|
|
||||||
let thiscurlString = curlStart + document.getElementById('curlUrl').value + curlMid1 + thisJSONledString + curlEnd;
|
let thiscurlString = curlStart + document.getElementById('curlUrl').value + curlMid1 + thisJSONledString + curlEnd;
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<h2>Convert image to WLED JSON (pixel art on WLED matrix)</h2>
|
<h2>Convert image to WLED JSON (pixel art on WLED matrix)</h2>
|
||||||
|
<h3>Version 1.0.3 - Help/About</h3>
|
||||||
<p>
|
<p>
|
||||||
<table id="fieldTable" style="width: 100%; table-layout: fixed; align-content: center;">
|
<table id="fieldTable" style="width: 100%; table-layout: fixed; align-content: center;">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -120,6 +121,15 @@
|
|||||||
<input class="fullTextField" type="text" id="curlUrl" value="">
|
<input class="fullTextField" type="text" id="curlUrl" value="">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align: middle;">
|
||||||
|
<label for="targetSegment">Target segment id:</label>
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align: middle;">
|
||||||
|
<select id="targetSegment">
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table class= "scaleTableClass" id="scaleTable" style="width: 100%; table-layout: fixed; align-content: center;">
|
<table class= "scaleTableClass" id="scaleTable" style="width: 100%; table-layout: fixed; align-content: center;">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -184,7 +194,9 @@
|
|||||||
<div id = "gap2" class="gap"></div>
|
<div id = "gap2" class="gap"></div>
|
||||||
<button id="fileJSONledbutton" class="buttonclass"></button>
|
<button id="fileJSONledbutton" class="buttonclass"></button>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3>Version 1.0.3 - <a href="https://github.com/werkstrom/WLED-PixelArtConverter/blob/main/README.md" target="_blank">Help/About</a></h3>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id=bottom-part style="display: none" class=bottom-part></div>
|
<div id=bottom-part style="display: none" class=bottom-part></div>
|
||||||
<canvas id="pixelCanvas"></canvas>
|
<canvas id="pixelCanvas"></canvas>
|
||||||
|
@@ -247,6 +247,39 @@ function sendAsFile(jsonStringInput, fileName, urlString) {
|
|||||||
xhr.send(formData);
|
xhr.send(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateSegmentOptions(array) {
|
||||||
|
//This function is prepared for a name property on each segment for easier selection
|
||||||
|
//Currently the name is generated generically based on index
|
||||||
|
var select = document.getElementById("targetSegment");
|
||||||
|
select.innerHTML = "";
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
var option = document.createElement("option");
|
||||||
|
option.value = array[i].value;
|
||||||
|
option.text = array[i].text;
|
||||||
|
select.appendChild(option);
|
||||||
|
if(i === 0) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Initial population of segment selection
|
||||||
|
function generateSegmentArray(noOfSegments) {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i < noOfSegments; i++) {
|
||||||
|
arr.push({
|
||||||
|
value: i,
|
||||||
|
text: "Segment index " + i
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
var segmentData = generateSegmentArray(10);
|
||||||
|
// [{"value":0, "text": "Segment index 0"},{"value":1, "text": "Segment index 1"},{"value":2, "text": "Segment index 2"},{"value":3, "text": "Segment index 3"}];
|
||||||
|
|
||||||
|
generateSegmentOptions(segmentData);
|
||||||
|
|
||||||
document.getElementById("fileJSONledbutton").innerHTML =
|
document.getElementById("fileJSONledbutton").innerHTML =
|
||||||
'<svg style="width:36px;height:36px" viewBox="0 0 24 24"><path fill="currentColor" d="M20 18H4V8H20M20 6H12L10 4H4A2 2 0 0 0 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V8A2 2 0 0 0 20 6M16 17H14V13H11L15 9L19 13H16Z" /></svg> File to device'
|
'<svg style="width:36px;height:36px" viewBox="0 0 24 24"><path fill="currentColor" d="M20 18H4V8H20M20 6H12L10 4H4A2 2 0 0 0 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V8A2 2 0 0 0 20 6M16 17H14V13H11L15 9L19 13H16Z" /></svg> File to device'
|
||||||
document.getElementById("convertbutton").innerHTML =
|
document.getElementById("convertbutton").innerHTML =
|
||||||
|
206
html/pixartmin.html
Normal file
206
html/pixartmin.html
Normal file
File diff suppressed because one or more lines are too long
@@ -10,10 +10,11 @@ const haMid4 = '\n command_off: >\n curl -X POST "http://';
|
|||||||
const haEnd = '/json/state" -d \'{"on":false}\' -H "Content-Type: application/json"';
|
const haEnd = '/json/state" -d \'{"on":false}\' -H "Content-Type: application/json"';
|
||||||
const haCommandLeading = ' ';
|
const haCommandLeading = ' ';
|
||||||
|
|
||||||
const JSONledStringStart = '{"on":true, "bri":';
|
const JSONledStringStart = '{"on":true,"bri":';
|
||||||
const JSONledStringMid1 = ', "seg":{"i":[';
|
const JSONledStringMid1 = ',"seg":{"id":';
|
||||||
const JSONledShortStringStart = '{';
|
const JSONledStringMid2 = ',"i":[';
|
||||||
const JSONledShortStringMid1 = '"seg":{"i":[';
|
// const JSONledShortStringStart = '{';
|
||||||
|
// const JSONledShortStringMid1 = '"seg":{"i":[';
|
||||||
const JSONledStringEnd = ']}}';
|
const JSONledStringEnd = ']}}';
|
||||||
|
|
||||||
var accentColor = '#7E4C80';
|
var accentColor = '#7E4C80';
|
||||||
|
@@ -33,6 +33,14 @@ h2 {
|
|||||||
line-height: 0.5;
|
line-height: 0.5;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
h3 {
|
||||||
|
font-size: 0.7em;
|
||||||
|
color: rgba(126, 76, 128, 0.61);
|
||||||
|
margin: 1px 0;
|
||||||
|
font-family: 'Arcade', Arial, sans-serif;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
@@ -230,3 +238,26 @@ textarea {
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: rgb(119, 119, 119);
|
color: rgb(119, 119, 119);
|
||||||
}
|
}
|
||||||
|
a:link {
|
||||||
|
color: rgba(126, 76, 128, 0.61);
|
||||||
|
background-color: transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:visited {
|
||||||
|
color: rgba(126, 76, 128, 0.61);
|
||||||
|
background-color: transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: rgb(126, 76, 128);
|
||||||
|
background-color: transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:active {
|
||||||
|
color: rgba(126, 76, 128, 0.61);
|
||||||
|
background-color: transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
Reference in New Issue
Block a user