diff options
| -rw-r--r-- | haunt/pages/weblabels.sxml | 8 | ||||
| -rw-r--r-- | haunt/static/image/oneko.gif | bin | 0 -> 3316 bytes | |||
| -rw-r--r-- | haunt/static/js/oneko.js | 182 | ||||
| -rw-r--r-- | org/Farewell, Kona, My Life-Long Companion/farewell-kona.org | 73 | ||||
| -rw-r--r-- | org/Farewell, Kona, My Life-Long Companion/kona-1.jpg | bin | 0 -> 82999 bytes | |||
| -rw-r--r-- | org/Farewell, Kona, My Life-Long Companion/kona-2.jpg | bin | 0 -> 147421 bytes | |||
| -rw-r--r-- | org/Farewell, Kona, My Life-Long Companion/kona-3.jpg | bin | 0 -> 271865 bytes | |||
| -rw-r--r-- | org/Farewell, Kona, My Life-Long Companion/kona-4.jpg | bin | 0 -> 292957 bytes |
8 files changed, 262 insertions, 1 deletions
diff --git a/haunt/pages/weblabels.sxml b/haunt/pages/weblabels.sxml index 3813cc0..4aaa3a3 100644 --- a/haunt/pages/weblabels.sxml +++ b/haunt/pages/weblabels.sxml @@ -35,4 +35,10 @@ (td ,(hyperlink "http://www.gnu.org/licenses/gpl-3.0.html" `(p "GNU General Public License 3.0 or later"))) (td ,(hyperlink "/static/js/rsvp.js" - `(p "/static/js/rsvp.js"))))))) + `(p "/static/js/rsvp.js")))) + (tr (td ,(hyperlink "/static/js/oneko.js" + `(p "/static/js/oneko.js"))) + (td ,(hyperlink "http://www.jclark.com/xml/copying.txt" + `(p "Expat License"))) + (td ,(hyperlink "/static/js/oneko.js" + `(p "/static/js/oneko.js"))))))) diff --git a/haunt/static/image/oneko.gif b/haunt/static/image/oneko.gif Binary files differnew file mode 100644 index 0000000..a009c2c --- /dev/null +++ b/haunt/static/image/oneko.gif diff --git a/haunt/static/js/oneko.js b/haunt/static/js/oneko.js new file mode 100644 index 0000000..b0ba164 --- /dev/null +++ b/haunt/static/js/oneko.js @@ -0,0 +1,182 @@ +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the “Software”), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +(function oneko() { + const nekoEl = document.createElement("div"); + let nekoPosX = 32; + let nekoPosY = 32; + let mousePosX = 0; + let mousePosY = 0; + let frameCount = 0; + let idleTime = 0; + let idleAnimation = null; + let idleAnimationFrame = 0; + const nekoSpeed = 10; + const spriteSets = { + idle: [[-3, -3]], + alert: [[-7, -3]], + scratch: [ + [-5, 0], + [-6, 0], + [-7, 0], + ], + tired: [[-3, -2]], + sleeping: [ + [-2, 0], + [-2, -1], + ], + N: [ + [-1, -2], + [-1, -3], + ], + NE: [ + [0, -2], + [0, -3], + ], + E: [ + [-3, 0], + [-3, -1], + ], + SE: [ + [-5, -1], + [-5, -2], + ], + S: [ + [-6, -3], + [-7, -2], + ], + SW: [ + [-5, -3], + [-6, -1], + ], + W: [ + [-4, -2], + [-4, -3], + ], + NW: [ + [-1, 0], + [-1, -1], + ], + }; + function create() { + nekoEl.id = "oneko"; + nekoEl.style.width = "32px"; + nekoEl.style.height = "32px"; + nekoEl.style.position = "fixed"; + nekoEl.style.backgroundImage = "url('/static/image/oneko.gif')"; + nekoEl.style.imageRendering = "pixelated"; + nekoEl.style.left = "16px"; + nekoEl.style.top = "16px"; + + document.body.appendChild(nekoEl); + + document.onmousemove = (event) => { + mousePosX = event.clientX; + mousePosY = event.clientY; + }; + + window.onekoInterval = setInterval(frame, 100); + } + + function setSprite(name, frame) { + const sprite = spriteSets[name][frame % spriteSets[name].length]; + nekoEl.style.backgroundPosition = `${sprite[0] * 32}px ${ + sprite[1] * 32 + }px`; + } + + function resetIdleAnimation() { + idleAnimation = null; + idleAnimationFrame = 0; + } + + function idle() { + idleTime += 1; + + // every ~ 20 seconds + if ( + idleTime > 10 && + Math.floor(Math.random() * 200) == 0 && + idleAnimation == null + ) { + idleAnimation = ["sleeping", "scratch"][ + Math.floor(Math.random() * 2) + ]; + } + + switch (idleAnimation) { + case "sleeping": + if (idleAnimationFrame < 8) { + setSprite("tired", 0); + break; + } + setSprite("sleeping", Math.floor(idleAnimationFrame / 4)); + if (idleAnimationFrame > 192) { + resetIdleAnimation(); + } + break; + case "scratch": + setSprite("scratch", idleAnimationFrame); + if (idleAnimationFrame > 9) { + resetIdleAnimation(); + } + break; + default: + setSprite("idle", 0); + return; + } + idleAnimationFrame += 1; + } + + function frame() { + frameCount += 1; + const diffX = nekoPosX - mousePosX; + const diffY = nekoPosY - mousePosY; + const distance = Math.sqrt(diffX ** 2 + diffY ** 2); + + if (distance < nekoSpeed || distance < 48) { + idle(); + return; + } + + idleAnimation = null; + idleAnimationFrame = 0; + + if (idleTime > 1) { + setSprite("alert", 0); + // count down after being alerted before moving + idleTime = Math.min(idleTime, 7); + idleTime -= 1; + return; + } + + direction = diffY / distance > 0.5 ? "N" : ""; + direction += diffY / distance < -0.5 ? "S" : ""; + direction += diffX / distance > 0.5 ? "W" : ""; + direction += diffX / distance < -0.5 ? "E" : ""; + setSprite(direction, frameCount); + + nekoPosX -= (diffX / distance) * nekoSpeed; + nekoPosY -= (diffY / distance) * nekoSpeed; + + nekoEl.style.left = `${nekoPosX - 16}px`; + nekoEl.style.top = `${nekoPosY - 16}px`; + } + + create(); +})(); diff --git a/org/Farewell, Kona, My Life-Long Companion/farewell-kona.org b/org/Farewell, Kona, My Life-Long Companion/farewell-kona.org new file mode 100644 index 0000000..850c1cd --- /dev/null +++ b/org/Farewell, Kona, My Life-Long Companion/farewell-kona.org @@ -0,0 +1,73 @@ +#+TITLE: A Good-Bye Letter To My Life-Long Companion +#+TAGS: non-technical +#+DATE: <2022-05-13 Fri 20:06> + +Last night -- Thursday, May 12th, 2022, at 22:17L -- my cat was put to rest. I +tend to avoid publishing anything non-technical to this website, but she +deserves to be remembered, and this is the only place I can be confident my +writing will last. She'd been with me through most of my life, always bringing +me comfort when I was stressed, and keeping watch over me when I was sick. I owe +this to her. + +[[./kona-1.jpg]] + +I begged my parents for a cat when I was young. It took several years, but they +eventually obliged and adopted my first cat, Donovan. He was put down a few +years later. My parents got Kona because they noticed how hurt I was to have +lost my best friend. We named her Kona after the Cree word for snow, ᑰᓇ, because +she had a beautiful, bright white coat of fur. + +Compared to Donovan, Kona was docile. She never tried to escape. She didn't even +like to be let outside. She always stayed alongside us. + +[[./kona-2.jpg]] + +She was occasionally playful, but for the most part would spend her days bathing +in the sun, or finding little hiding places next to my dad. When it got cold, +she would rest herself on my chest or lap. She was a great companion, for all +the years that she was with us. + +She especially liked to join me when I was playing video games. One time, I was +playing Metal Gear Solid, and she trotted up to the TV -- following Snake as he +ran across the screen and batting at him with her paw. + +Batting at stuff with her paw was her thing. If I walked past her without +petting her, she'd either bat at me, or be a little more aggressive and dig into +my leg with her claws. She also frequently beat up the other cat in the house.. +and other times, they were the best of friends. They made an excellent team for +killing the mice in the basement -- Kona would find them, and then go bat Mitzi +until Mitzi killed it. + +[[./kona-3.jpg]] + +When I moved back in with my parents at the beginning of the COVID-19 pandemic +(when UMass kicked us all out and went online for classes) my younger brother +voluntarily moved his rig into the basement[fn:1], and Kona started to hang out +with him. She'd sit on his desk, accompanying him while he programmed or played +video games. + +She'd even accompany him when he was working out in the home gym. Karl told me +once about how he was mid-way through a set, and Kona hopped up on his chest and +made herself comfortable. + +[[./kona-4.jpg]] + +She didn't come up from the basement often. She'd spend her days with Karl, and +her nights curled up on my dad's chest. Near the end, the only times I would see +her is when I'd feed her. I had a hard time noticing her deteriorating health. +Only really a suspicion -- on her last day -- when she came up to my desk while +I was working, and refused the cat food I fetched for her. Karl and my partner +were more keen to realizing that things were going downhill, so we took her to +the emergency vet that night. + +And that was the most I've cried. Ever. Kona was my girl. She really had an +impact on me in the time we had together. Life is never going to be the same +without her little mewls in the middle of the night. + +Farewell, Kona. I will always love you. + +/(The cat following your cursor, if you have Javascript enabled, is courtesy of [[https://adryd.com/][Ariana]].)/ + +--- + +[fn:1] To this day, I think he actually drew the long straw. He's right next to the home gym, the router, he's got plenty of space... diff --git a/org/Farewell, Kona, My Life-Long Companion/kona-1.jpg b/org/Farewell, Kona, My Life-Long Companion/kona-1.jpg Binary files differnew file mode 100644 index 0000000..79d40dc --- /dev/null +++ b/org/Farewell, Kona, My Life-Long Companion/kona-1.jpg diff --git a/org/Farewell, Kona, My Life-Long Companion/kona-2.jpg b/org/Farewell, Kona, My Life-Long Companion/kona-2.jpg Binary files differnew file mode 100644 index 0000000..4ce3d51 --- /dev/null +++ b/org/Farewell, Kona, My Life-Long Companion/kona-2.jpg diff --git a/org/Farewell, Kona, My Life-Long Companion/kona-3.jpg b/org/Farewell, Kona, My Life-Long Companion/kona-3.jpg Binary files differnew file mode 100644 index 0000000..16d2b2c --- /dev/null +++ b/org/Farewell, Kona, My Life-Long Companion/kona-3.jpg diff --git a/org/Farewell, Kona, My Life-Long Companion/kona-4.jpg b/org/Farewell, Kona, My Life-Long Companion/kona-4.jpg Binary files differnew file mode 100644 index 0000000..19e7af9 --- /dev/null +++ b/org/Farewell, Kona, My Life-Long Companion/kona-4.jpg |