diff options
-rw-r--r-- | assets/blog/logo/grim.png | bin | 0 -> 4533 bytes | |||
-rw-r--r-- | assets/blog/logo/hit.png | bin | 0 -> 4341 bytes | |||
-rw-r--r-- | assets/blog/logo/left.png | bin | 0 -> 3957 bytes | |||
-rw-r--r-- | assets/blog/logo/right.png (renamed from assets/logos/right.png) | bin | 3948 -> 3948 bytes | |||
-rw-r--r-- | assets/blog/logo/state-1-front.png | bin | 0 -> 17683 bytes | |||
-rw-r--r-- | assets/blog/logo/state-1-grim.png | bin | 0 -> 17433 bytes | |||
-rw-r--r-- | assets/blog/logo/state-1-left.png | bin | 0 -> 17491 bytes | |||
-rw-r--r-- | assets/blog/logo/state-1-right.png | bin | 0 -> 17603 bytes | |||
-rw-r--r-- | assets/blog/logo/state-1-scream.png | bin | 0 -> 18089 bytes | |||
-rw-r--r-- | assets/blog/logo/state-2-front.png | bin | 0 -> 17881 bytes | |||
-rw-r--r-- | assets/blog/logo/state-2-grim.png | bin | 0 -> 17426 bytes | |||
-rw-r--r-- | assets/blog/logo/state-2-left.png | bin | 0 -> 17504 bytes | |||
-rw-r--r-- | assets/blog/logo/state-2-right.png | bin | 0 -> 17460 bytes | |||
-rw-r--r-- | assets/blog/logo/state-2-scream.png | bin | 0 -> 18292 bytes | |||
-rw-r--r-- | assets/blog/logo/state-3-front.png | bin | 0 -> 18353 bytes | |||
-rw-r--r-- | layouts/blog/baseof.html | 133 |
16 files changed, 121 insertions, 12 deletions
diff --git a/assets/blog/logo/grim.png b/assets/blog/logo/grim.png Binary files differnew file mode 100644 index 0000000..49d5a0d --- /dev/null +++ b/assets/blog/logo/grim.png diff --git a/assets/blog/logo/hit.png b/assets/blog/logo/hit.png Binary files differnew file mode 100644 index 0000000..bd195ce --- /dev/null +++ b/assets/blog/logo/hit.png diff --git a/assets/blog/logo/left.png b/assets/blog/logo/left.png Binary files differnew file mode 100644 index 0000000..3ff9f87 --- /dev/null +++ b/assets/blog/logo/left.png diff --git a/assets/logos/right.png b/assets/blog/logo/right.png Binary files differindex d19f89c..d19f89c 100644 --- a/assets/logos/right.png +++ b/assets/blog/logo/right.png diff --git a/assets/blog/logo/state-1-front.png b/assets/blog/logo/state-1-front.png Binary files differnew file mode 100644 index 0000000..b6473c4 --- /dev/null +++ b/assets/blog/logo/state-1-front.png diff --git a/assets/blog/logo/state-1-grim.png b/assets/blog/logo/state-1-grim.png Binary files differnew file mode 100644 index 0000000..5888d02 --- /dev/null +++ b/assets/blog/logo/state-1-grim.png diff --git a/assets/blog/logo/state-1-left.png b/assets/blog/logo/state-1-left.png Binary files differnew file mode 100644 index 0000000..8085215 --- /dev/null +++ b/assets/blog/logo/state-1-left.png diff --git a/assets/blog/logo/state-1-right.png b/assets/blog/logo/state-1-right.png Binary files differnew file mode 100644 index 0000000..9b0faca --- /dev/null +++ b/assets/blog/logo/state-1-right.png diff --git a/assets/blog/logo/state-1-scream.png b/assets/blog/logo/state-1-scream.png Binary files differnew file mode 100644 index 0000000..3d2a290 --- /dev/null +++ b/assets/blog/logo/state-1-scream.png diff --git a/assets/blog/logo/state-2-front.png b/assets/blog/logo/state-2-front.png Binary files differnew file mode 100644 index 0000000..940c169 --- /dev/null +++ b/assets/blog/logo/state-2-front.png diff --git a/assets/blog/logo/state-2-grim.png b/assets/blog/logo/state-2-grim.png Binary files differnew file mode 100644 index 0000000..f5996da --- /dev/null +++ b/assets/blog/logo/state-2-grim.png diff --git a/assets/blog/logo/state-2-left.png b/assets/blog/logo/state-2-left.png Binary files differnew file mode 100644 index 0000000..7b43a7a --- /dev/null +++ b/assets/blog/logo/state-2-left.png diff --git a/assets/blog/logo/state-2-right.png b/assets/blog/logo/state-2-right.png Binary files differnew file mode 100644 index 0000000..f5a2017 --- /dev/null +++ b/assets/blog/logo/state-2-right.png diff --git a/assets/blog/logo/state-2-scream.png b/assets/blog/logo/state-2-scream.png Binary files differnew file mode 100644 index 0000000..105986e --- /dev/null +++ b/assets/blog/logo/state-2-scream.png diff --git a/assets/blog/logo/state-3-front.png b/assets/blog/logo/state-3-front.png Binary files differnew file mode 100644 index 0000000..4a0d4a2 --- /dev/null +++ b/assets/blog/logo/state-3-front.png diff --git a/layouts/blog/baseof.html b/layouts/blog/baseof.html index 0689e3d..0a05607 100644 --- a/layouts/blog/baseof.html +++ b/layouts/blog/baseof.html @@ -292,24 +292,133 @@ <header> <div class="logo"> - {{- $logo1x := resources.Get "blog/logo/front.png" }} - <a href="/blog"> - <img - style=" - width: auto; - height: 90px;" - src="{{ $logo1x.Permalink }}" - width="{{ $logo1x.Width }}" - height="{{ $logo1x.Height }}" - loading="lazy"> - </a> + {{- $img := resources.Get "blog/logo/front.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + <img + alt="Michal" + id="face" + style="cursor: crosshair;" + src="{{ $img1x.Permalink }}" + srcset=" + {{ $img1x.Permalink }} 1x, + {{ $img2x.Permalink }} 2x + " + width="{{ $img1x.Width }}" + height="{{ $img1x.Height }}" + > + <script> + const faces = { + normal:{ + front: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/left.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + left: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/right.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + right: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + }, + state1:{ + {{- $img := resources.Get "blog/logo/state-1-front.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + front: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/state-1-left.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + left: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/state-1-right.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + right: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + }, + state2:{ + {{- $img := resources.Get "blog/logo/state-2-front.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + front: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/state-2-left.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + left: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/state-2-right.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + right: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + }, + state3:{ + {{- $img := resources.Get "blog/logo/state-3-front.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + front: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/state-3-front.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + left: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + {{- $img := resources.Get "blog/logo/state-3-front.png" }} + {{- $img1x := $img.Resize "100x webp" }} + {{- $img2x := $img.Resize "200x webp" }} + right: [ {{ $img1x.Permalink }}, {{ $img2x.Permalink }} ], + } + } + + let health = 100; + let state = "normal" + + const faceImg = document.getElementById('face'); + + faceImg.addEventListener( 'click', function() { + health--; + + if(health < 100) { state = "state1" } + if(health < 50) { state = "state2" } + if(health < 1) { state = "state3" } + + updateFace(getStateFaces().front); + document.body.style.background = "#ff0000"; + setTimeout( + () => { document.body.style.background = null }, + 10) + + + console.log(`state: ${state}; health: ${health}`); + + }) + + const getStateFaces = () => { + return faces[state] + } + + const updateFace = (faceUrls) => { + faceImg.src = faceUrls[0]; + faceImg.srcset = ` ${faceUrls[0]} 1x, ${faceUrls[1]} 2x` + } + + lookFront = () => { + updateFace(getStateFaces().front); + setTimeout(lookLeft, 5000); + } + lookLeft = () => { + updateFace(getStateFaces().left); + setTimeout(lookRight, 500); + } + lookRight = () => { + updateFace(getStateFaces().right) + setTimeout(lookFront, 500); + } + + lookFront(); + + </script> </div><div class="name"> <a href="/blog">MichaĆ's weblog</a> </div><nav> <a href="/">Homepage</a> <a href="/about" target="_blank">About</a> - <a href="/blog/index.xml">Rss</a> + <a href="/blog/index.xml">RSS</a> </nav> </header> |