From 3a396753ef985699b52dd056796f338415c99b37 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 31 Oct 2021 00:31:46 +0100 Subject: added gif image generation --- build.sh | 5 ++++ gif.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++ git_repos.txt | 3 ++- images/bg.gif | Bin 554478 -> 234212 bytes images/remotecontrol.gif | Bin 0 -> 309948 bytes images/remotecontrol.png | Bin 1591562 -> 5017 bytes resources/style.css | 7 +++++- sync.sh | 3 --- templates/about.html | 2 +- 9 files changed, 78 insertions(+), 6 deletions(-) create mode 100755 build.sh create mode 100644 gif.py create mode 100644 images/remotecontrol.gif 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 Binary files a/images/bg.gif and b/images/bg.gif differ diff --git a/images/remotecontrol.gif b/images/remotecontrol.gif new file mode 100644 index 0000000..c7c8a81 Binary files /dev/null and b/images/remotecontrol.gif differ diff --git a/images/remotecontrol.png b/images/remotecontrol.png index 8a0a2da..ad9ec97 100644 Binary files a/images/remotecontrol.png and b/images/remotecontrol.png 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 @@

if you want to contact me, you can message me on matrix @davidovski:matrix.org (i will make my own homeserver soon ok?) or discord iksvo#6239. I'll be also happy to reply to any emails, linked at the top of the page

- +

-- cgit v1.2.1