Skip to content

Instantly share code, notes, and snippets.

View piman51277's full-sized avatar
Coffee!!

piman piman51277

Coffee!!
View GitHub Profile
@piman51277
piman51277 / types.ts
Created June 9, 2022 23:22
Typescript Types of the Team Fortress 2 (Tf2) Item Schema
//Field descriptions from the Tf2 Wiki:
//https://wiki.teamfortress.com/wiki/WebAPI/GetSchema
//This was created based on the Tf2 Schema from Jun 2022
//While some fields have been generalized to adapt to future TF2 versions, others have not.
export type rawTf2Schema = {
result: {
status: number; //Should always be 1
items_name_url: string; //A string containing the URL to the full item schema as used by the game.
items: rawTf2SchemaItem[]; //A list of item objects.
@piman51277
piman51277 / bezier.js
Last active September 14, 2021 22:18
Small class to generate points on a bezier curve
class BezierCurve {
static quadratic(x0, y0, x1, y1, x2, y2, steps) {
const points = [];
for (let step = 0; step <= steps; step++) {
const t = step / steps;
const [lx0, ly0] = interp(x0, y0, x1, y1, t);
const [lx1, ly1] = interp(x1, y1, x2, y2, t);