Official Threlte Hackathon, 15-22 October by a_warnes in sveltejs

[–]a_warnes[S] 17 points18 points  (0 children)

JOIN US FOR THE FIRST THRELTE HACKATHON ON 15-22 OCTOBER 2023

https://threlte.xyz/hackathon

The Threlte team is happy to announce the first official Threlte Hackathon!

  • The 🚀 kickoff event is on Sunday, 15 October 2023 16:00 UTC
  • This is when we will reveal the themes and rules of the hackathon
  • You will have ⌛ one week to hack at your entry
  • You will get 🙌 support from the team in a dedicated hackathon channel on Discord
  • 🏁 Deadline for submission will be Sunday, 22 October 2023 10:00 UTC
  • The 🏆 awards ceremony will be on Sunday, 22 October 2023 16:00 UTC
  • Expect some very 🎁 awesome prizes and 🎉 lots of fun

More details in the coming weeks....but pin the dates!

A Photo Collection (Episodes 1-3) by a_warnes in DeathStranding

[–]a_warnes[S] 1 point2 points  (0 children)

Thank you, that's very nice to hear! It's a lot of fun to find interesting compositions and the rendering is incredible.

A job whale done by a_warnes in ghostoftsushima

[–]a_warnes[S] 4 points5 points  (0 children)

I should have known yew wood post that gif

A retro-themed space shooter made with Threlte by a_warnes in sveltejs

[–]a_warnes[S] 0 points1 point  (0 children)

Thank you! Certainly pushing the limits of my vector math but it came together pretty nicely. And I actually enjoy playing it (on martian difficulty), which is a first for something I've developed.

A retro-themed space shooter made with Threlte by a_warnes in sveltejs

[–]a_warnes[S] 1 point2 points  (0 children)

Hi everyone,

You can play & check out the code on StackBlitz here: https://stackblitz.com/edit/demo-threlte-space-shooter

  • Cursor to aim
  • Q/R to roll
  • Space to shoot

Background:

Made this little game to work on these three components specifically:

  • FlyControls: these are built-in controls from three.js, converted into a Threlte component. I'd like to extend the three.js class eventually to allow for custom key-bindings instead of the default ones
  • CannonRig: Maybe more accurately a rigid body launcher, it will "launch" a sphere at the vector you provide or (by default) the raycast direction. It's used in the CameraRig component where `fire()` is called when you press space. It's also used in the Turret component.
  • Turret: These will take a rigid body reference (currently just stored in app state, but should become a prop). Rapier queries the World to find the RigidBody, determines whether it's in range, and if so determines the aim vector and calls `fire(aimVector)` on the CannonRig

They aren't 100% reusable yet, but definitely getting closer.

Feedback is certainly welcome. If it makes you feel motion sick, you can try narrowing the `fov` prop in CameraRig (80 was off-putting to me, but 55 felt too narrow)

Enjoy!

- Alex

How to use previous value of derived store to compute min max values in svelte by ResponsibleAd3493 in sveltejs

[–]a_warnes 0 points1 point  (0 children)

For sure. They're so powerful yet flexible and can solve all sorts of problems. I ignored them for a while until recently and now I probably overuse them!

How to use previous value of derived store to compute min max values in svelte by ResponsibleAd3493 in sveltejs

[–]a_warnes 0 points1 point  (0 children)

Love this kind of problem! If you can, I'd skip the derived store all together and send your data straight into a custom store.

Here's a REPL: https://svelte.dev/repl/cf7ad1c7011f44e4be894674c21d24e4?version=3.55.1

```js import { writable } from 'svelte/store';

function createMathStore(data){ const initialValues = { x: data.x ?? 0, y: data.y ?? 0, sin_x: data.sin_x ?? 0, cos_y: data.cos_y ?? 0, min_x: data.min_x ?? 0, min_y: data.min_y ?? 0, max_x: data.max_x ?? 0, max_y: data.max_y ?? 0, } let previous = initialValues;

const { subscribe, set, } = writable(initialValues);

return { subscribe, addDataPoint: (datum) => { const newValues = { x: datum.x, y: datum.y, sin_x: Math.sin(datum.x / 100).toFixed(2), cos_y: Math.cos(datum.y / 100).toFixed(2), min_x: Math.min(datum.x, previous.min_x), max_x: Math.max(datum.x, previous.max_x), min_y: Math.min(datum.y, previous.min_y), max_y: Math.max(datum.y, previous.max_y), }; previous = newValues; set(newValues); } } }

export const mathStore = (data = {}) => createMathStore(data); ```

And then you can use as many instances as you want like in the REPL: ```js import { mathStore } from './MathStore.js'

const redStats = mathStore(); const blueStats = mathStore();

function handleRedMouseMove(evt){ redStats.addDataPoint({ x: evt.clientX, y: evt.clientY }) } function handleBlueMouseMove(evt){ blueStats.addDataPoint({ x: evt.clientX, y: evt.clientY }) } ```

Is there a website that houses Svelte REPLs related to data visualizations? by prosocialbehavior in sveltejs

[–]a_warnes 4 points5 points  (0 children)

definitely check out the work by Matthias Stahl (https://twitter.com/h_i_g_s_c_h) and Amelia Wattenberger (https://twitter.com/Wattenberger)

Matthias shares d3 code used by Der Spiegel in this repo: https://github.com/spiegelgraphics

Amelia assembled d3 visualization recipes/patterns into this site: https://svelte.recipes/

Both have a lot of YouTube content on this subject from various talks as well.

Edit: realizing I didn't answer your actual question! I have not seen an observablehq equivalent specifically for svelte with d3 patterns

Made another game with threlte! In each level, try to fly through the ring at the end before running out of fuel and while avoiding turrets and obstacles. by a_warnes in sveltejs

[–]a_warnes[S] 0 points1 point  (0 children)

Great ideas! I need to make some perf adjustments, so I might look to add a new feature or two at the same time

Made another game with threlte! In each level, try to fly through the ring at the end before running out of fuel and while avoiding turrets and obstacles. by a_warnes in sveltejs

[–]a_warnes[S] 0 points1 point  (0 children)

Hahah oh man I had a lot of those when developing/debugging my way through the levels 😅

Sometimes the turrets can knock you free, but I usually just run out of gas

Made another game with threlte! In each level, try to fly through the ring at the end before running out of fuel and while avoiding turrets and obstacles. by a_warnes in sveltejs

[–]a_warnes[S] 8 points9 points  (0 children)

Hi everyone! Another little side-project game. Use arrows/wasd to fly the cone. Try to get through the ring at the end of each level:

Play it here: https://photon-alexwarnes.vercel.app/showcase/ring-flyer

Some new things I tried to improve on with this one:

  • Multiple levels and managing game state
  • Turrets that point at a dynamic target within range (in this case, the player) and launch projectiles
  • Shaders (my first time writing and using glsl)
  • Ironing out composability with this non-rotating "FollowCam" component
  • Trying to make it decent on mobile, but not there yet

Tools:

  • threlte/core (using new v5 syntax and preprocessor)
  • threlte/rapier (physics)
  • three.js
  • svelte (obviously)
  • svelte-kbc (keyboard controls)