Skip to content

Instantly share code, notes, and snippets.

@Bendzae
Bendzae / scene.tsx
Last active December 30, 2023 13:05
Three.js camera movement on scroll
// Three JS scene component
const Scene = () => {
const camPositionKeyframes = new Map([
[0, new Vector3(0,1000,0)],
[0.5, new Vector3(500,1000,-200)],
[1.0, new Vector3(1000,1000,400)],
[1.5, new Vector3(1500,1000,-800)],
];
@Bendzae
Bendzae / slash.wgsl
Created October 23, 2023 15:34
Slash Shader
#import bevy_pbr::mesh_vertex_output MeshVertexOutput
#import bevy_pbr::mesh_view_bindings globals
#import silva::test test
struct SlashMaterial {
color: vec4<f32>,
spawn_time: f32,
}
@group(1) @binding(0)
@Bendzae
Bendzae / snaphot_interpolation.rs
Created October 10, 2023 15:29
Snapshot interpolation plugin for bevy_replicon
struct SnapshotInterpolationPlugin {
max_tick_rate: u16,
}
impl Plugin for SnapshotInterpolationPlugin {
fn build(&self, app: &mut App) {
app.replicate::<Interpolated>()
.insert_resource(InterpolationConfig {
max_tick_rate: self.max_tick_rate,
});
}
@Bendzae
Bendzae / aoc_03.rs
Created February 3, 2023 11:04
aoc 22 day 3
use std::fs;
fn find_common_types(input: String) -> Vec<char> {
return input
.lines()
.map(|line| line.trim())
.map(|line| {
let compartment_1 = &line[0..line.len() / 2];
let compartment_2 = &line[line.len() / 2..line.len()];