summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2021-10-31 00:31:46 +0100
committerdavidovski <david@davidovski.xyz>2021-10-31 00:31:46 +0100
commit3a396753ef985699b52dd056796f338415c99b37 (patch)
treeba121cd2215e12d4ecbc8a0393aa66faba20b44c
parent83ea97d28fe569e90311713379fdb47c453a3a1c (diff)
added gif image generation
-rwxr-xr-xbuild.sh5
-rw-r--r--gif.py64
-rw-r--r--git_repos.txt3
-rw-r--r--images/bg.gifbin554478 -> 234212 bytes
-rw-r--r--images/remotecontrol.gifbin0 -> 309948 bytes
-rw-r--r--images/remotecontrol.pngbin1591562 -> 5017 bytes
-rw-r--r--resources/style.css7
-rwxr-xr-xsync.sh3
-rw-r--r--templates/about.html2
9 files changed, 78 insertions, 6 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..aca6407
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+python gif.py
+python build.py
+./sync.sh
+
diff --git a/gif.py b/gif.py
new file mode 100644
index 0000000..9f0c699
--- /dev/null
+++ b/gif.py
@@ -0,0 +1,64 @@
+import glob
+import math
+import random
+from PIL import Image
+
+
+def color(hex_value):
+ h = hex_value.lstrip('#')
+ while len(h) < 8:
+ h += "f"
+ return tuple(int(h[i:i+2], 16) for i in (0, 2, 4, 6))
+
+def rgb_to_v(c):
+ r, g, b = c[0]/255.0, c[1]/255.0, c[2]/255.0
+ mx = max(r, g, b)
+ v = mx*100
+ return v
+
+replace = color("#f58f44")
+colors = [
+ color("#191919"),
+ color("#282a2e"),
+ color("#373b41"),
+ color("#f58f44")
+ ]
+
+sorted(colors, key=rgb_to_v)
+p = len(colors)
+
+def make(filename, inp=None):
+ w = int(256 / p) * p
+ h = int(256 / p) * p
+
+ frames = []
+
+ for i in range(int(p*1*math.pi)):
+ if inp is None:
+ image = Image.new("RGBA", (w, h), colors[0])
+ else:
+ image = Image.open(inp)
+
+ for x in range(image.width):
+ for y in range(image.height):
+ f = 2
+ r = random.randint(-f, f)
+ z = (i) - (y/(p/4)) + r
+ v = math.floor( (math.sin(z) + 1) * len(colors) * 0.5)
+ c = colors[v]
+ if inp is not None:
+ existing = image.getpixel((x, y))
+ if existing == replace:
+ image.putpixel((x,y), c)
+ else:
+ image.putpixel((x,y), c)
+
+ frames.append(image)
+
+
+ frames[0].save(filename, format="GIF", append_images=frames[1:], save_all=True, duration=100, loop=0)
+
+make("images/bg.gif")
+make("images/remotecontrol.gif", inp="images/remotecontrol.png")
+
+
diff --git a/git_repos.txt b/git_repos.txt
index f927219..f3983ac 100644
--- a/git_repos.txt
+++ b/git_repos.txt
@@ -1,5 +1,6 @@
https://git.davidovski.xyz/davidovski.git
-https://git.davidovski.xyz/xibuild.git
+https://git.davidovski.xyz/xilinux/xibuild.git
+https://git.davidovski.xyz/xilinux/xipkg.git
https://git.davidovski.xyz/dot.git
https://github.com/davidovski/glsl-mandelbrot.git
https://github.com/davidovski/dungeon-generator.git
diff --git a/images/bg.gif b/images/bg.gif
index 31fa140..052c1ad 100644
--- a/images/bg.gif
+++ b/images/bg.gif
Binary files differ
diff --git a/images/remotecontrol.gif b/images/remotecontrol.gif
new file mode 100644
index 0000000..c7c8a81
--- /dev/null
+++ b/images/remotecontrol.gif
Binary files differ
diff --git a/images/remotecontrol.png b/images/remotecontrol.png
index 8a0a2da..ad9ec97 100644
--- a/images/remotecontrol.png
+++ b/images/remotecontrol.png
Binary files differ
diff --git a/resources/style.css b/resources/style.css
index b0c66fa..76b4338 100644
--- a/resources/style.css
+++ b/resources/style.css
@@ -23,9 +23,9 @@ body {
background-color: var(--bg-light);
background-image: url("/images/bg.gif");
background-repeat: repeat;
+ background-attachment: fixed;
/*background-image: url("https://davidovski.xyz/images/bg.png");*/
- background-position: absolute;
color: var(--fg);
font-family: mononoki;
font-size: 16px;
@@ -38,6 +38,11 @@ a {
text-decoration: none;
}
+a:hover {
+ color: var(--cyan);
+ text-decoration: underline;
+}
+
h1 {
color: var(--white);
}
diff --git a/sync.sh b/sync.sh
index 25107f9..01c8d21 100755
--- a/sync.sh
+++ b/sync.sh
@@ -1,8 +1,5 @@
#!/bin/bash
-python build.py
rsync -Lta --no-perms --no-owner --no-group --delete --exclude=sync.sh -z -e ssh ./html/ cheetah:/srv/www/davidovski/html
-
ssh -t cheetah "ln -s /srv/shared/site/* /srv/www/davidovski/html/"
-
# git push # push after everything to keep it all backed up
diff --git a/templates/about.html b/templates/about.html
index 7a7f30f..8937865 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -7,7 +7,7 @@
<p>if you want to contact me, you can message me on matrix <code>@davidovski:matrix.org</code> (i will make my own homeserver soon ok?) or discord <code>iksvo#6239</code>. I'll be also happy to reply to any emails, linked at the top of the page</p>
</div>
<div class="image">
- <img src="/images/remotecontrol.png">
+ <img src="/images/remotecontrol.gif">
</div>
</div>
<hr>