Skip to content

Commit a73793f

Browse files
committed
update site
1 parent 558fb6f commit a73793f

8 files changed

Lines changed: 58 additions & 14 deletions

File tree

src/components/physics/TechStackBox.svelte

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import Icon from "@iconify/svelte";
3-
import { Body, Box, Edge, Vec2, World } from "planck";
3+
import { Body, Box, Edge, MouseJoint, Vec2, World } from "planck";
44
import { onMount } from "svelte";
55
import Tooltip from "../utils/Tooltip.svelte";
66
@@ -91,16 +91,60 @@ Box
9191
clearInterval(interval);
9292
data.boxes = []
9393
}
94+
95+
function registerItemDrag(e: PointerEvent, box: Body) {
96+
let target = e.target as HTMLElement;
97+
target.setPointerCapture(e.pointerId);
98+
99+
console.log("dragging", target, box);
100+
101+
function getTarget(ev: PointerEvent) {
102+
let fontSize = parseFloat(window.getComputedStyle(target).fontSize);
103+
let boundingBox = divHolder.getBoundingClientRect();
104+
return new Vec2(
105+
(ev.clientX - boundingBox.left - boundingBox.width / 2) / fontSize / 2,
106+
-(ev.clientY - boundingBox.bottom) / fontSize / 2
107+
)
108+
}
109+
110+
let joint: MouseJoint | null = null;
111+
world.queueUpdate((world) => {
112+
joint = new MouseJoint({
113+
maxForce: 1000,
114+
target: getTarget(e),
115+
bodyA: world.createBody(),
116+
bodyB: box,
117+
});
118+
world.createJoint(joint);
119+
});
120+
121+
function onBoxPointerMove(ev: PointerEvent) {
122+
joint?.setTarget(getTarget(ev));
123+
}
124+
125+
function onBoxPointerUp(ev: PointerEvent) {
126+
world.queueUpdate((world) => {
127+
if (joint) world.destroyJoint(joint);
128+
});
129+
target.removeEventListener("pointermove", onBoxPointerMove);
130+
target.removeEventListener("pointerup", onBoxPointerUp);
131+
}
132+
133+
target.addEventListener("pointermove", onBoxPointerMove);
134+
target.addEventListener("pointerup", onBoxPointerUp);
135+
}
94136
</script>
95137

96138
<ul class="tech-stack" bind:this={divHolder}>
97139
{#each data.boxes as box, index}
98140
<li class="tech-stack-box"
99-
style:transform={(data.counter, `translate(${box.getPosition().x * 2}em, ${-box.getPosition().y * 2}em) rotate(${-box.getAngle()}rad)`)}
100-
style:--bg-color={items[index].color}
101-
style:--size={`${items[index].priority}em`}
102-
style={items[index].boxStyle}
103-
aria-label={items[index].name}>
141+
style:transform={(data.counter, `translate(${box.getPosition().x * 2}em, ${-box.getPosition().y * 2}em) rotate(${-box.getAngle()}rad)`)}
142+
style:--bg-color={items[index].color}
143+
style:--size={`${items[index].priority}em`}
144+
style={items[index].boxStyle}
145+
aria-label={items[index].name}
146+
onpointerdown={(e) => registerItemDrag(e, box)}
147+
>
104148
<Tooltip>{items[index].name}</Tooltip>
105149
{#if items[index].iconURL}
106150
<img src={items[index].iconURL} alt="" aria-hidden={true} />

src/components/webrings/LeakyRing.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@
173173
margin: -1em;
174174
background:
175175
linear-gradient(black, black) top left / 100% calc(100% - var(--level, 0) * 100%) no-repeat,
176-
url(/index/res/images/wave.svg) left calc(calc(1 - var(--level, 0)) * calc(100% + 19px)) / 200px 20px repeat-x,
177-
url(/index/res/images/wave2.svg) left calc(calc(1 - var(--level, 0)) * calc(100% + 29px)) / 300px 30px repeat-x,
176+
url(/index/res/images/wave.svg) left calc(calc(1 - var(--level, 0)) * calc(100% + 19.9px)) / 200px 20px repeat-x,
177+
url(/index/res/images/wave2.svg) left calc(calc(1 - var(--level, 0)) * calc(100% + 29.9px)) / 300px 30px repeat-x,
178178
url(/index/res/images/tiling-bg.svg) repeat,
179179
linear-gradient(#5df, #59f);
180180
transition: background 2s cubic-bezier(0.075, 0.82, 0.165, 1);

src/data/projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const games: ProjectCollection = {
2222
name: "One Trillion Free Draws",
2323
description: `
2424
<p>
25-
The definitive idle games where you have 1,000,000,000,000 free card packs to draw. That's 1 followed by 12 zeros!
25+
The definitive idle game where you have 1,000,000,000,000 free card packs to draw. That's 1 followed by 12 zeros!
2626
</p>
2727
<p>
2828
It's fairly mobile-friendly and should be completable in about 2~3 days of active idling.

static/index/res/images/tiling-bg.svg

Lines changed: 1 addition & 1 deletion
Loading

static/index/res/images/tiling-spikes-left.svg

Lines changed: 1 addition & 1 deletion
Loading

static/index/res/images/tiling-spikes-right.svg

Lines changed: 1 addition & 1 deletion
Loading

static/index/res/images/wave.svg

Lines changed: 1 addition & 1 deletion
Loading

static/index/res/images/wave2.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)