From e88dcc3ceb38cb0d4494016df7556e968f97a678 Mon Sep 17 00:00:00 2001 From: stage7 Date: Sat, 28 Sep 2024 23:45:49 +0200 Subject: First commit --- jtanimator.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 jtanimator.php (limited to 'jtanimator.php') diff --git a/jtanimator.php b/jtanimator.php new file mode 100644 index 0000000..ff04f01 --- /dev/null +++ b/jtanimator.php @@ -0,0 +1,46 @@ +> 16) & (0xff == 255)) { $bitsData[0] .= "1"; } else { $bitsData[0] .= "0"; } + if (($col >> 8) & (0xff == 255)) { $bitsData[1] .= "1"; } else { $bitsData[1] .= "0"; } + if ($col & (0xff == 255)) { $bitsData[2] .= "1"; } else { $bitsData[2] .= "0"; } + + if ($pixelNumber > 0 && $pixelNumber % 8 == 7) { + $bitsData[0] .= ","; + $bitsData[1] .= ","; + $bitsData[2] .= ","; + } + + $pixelNumber++; + } + } +} + +$aniData = []; +$toDec = function ($value) { + return bindec($value); +}; + +for ($i = 0; $i < 3; $i++) { + $tempData = explode(",", $bitsData[$i]); + array_pop($tempData); + $tempDataDec = array_map($toDec, $tempData); + for ($j = 0; $j < count($tempDataDec); $j++) { + $aniData[] = $tempDataDec[$j]; + } +} + +echo "
";
+print_r('[{"data":{"aniData":[');
+print_r(implode(",", $aniData));
+print_r('],"aniType":1,"delays":300,"frameNum":' . $height / 16 . ',"pixelHeight":16,"pixelWidth":32},"dataType":0}]');
+echo "
"; -- cgit v1.2.3