Skip to content

Instantly share code, notes, and snippets.

View snuffyDev's full-sized avatar
😮‍💨
nice

snuffy snuffyDev

😮‍💨
nice
View GitHub Profile
@snuffyDev
snuffyDev / core_motionPath.ts
Created August 27, 2023 23:44
TypeScript Animation library
import { EasingFunction, linear } from "./easing";
import { TweenOptions } from "./tween";
import { CSSTransform, KeyframeWithTransform } from "./types";
import { pathStringToSVGPath } from "./utils/path";
import { buildTransform, isTransform } from "./utils/transform";
import * as easings from "./easing";
import { keysWithType } from "./utils/object";
export type PathTweenOptions = TweenOptions & MotionPathOptions;
export type Anchor = NonNullable<MotionPathOptions["anchor"]>;
import { EasingFactory, EasingFunction, linear } from "./easing";
import { MotionPath, PathTweenOptions } from "./motionPath";
import type { KeyframeWithTransform } from "./types";
import { skipFirstInvocation } from "./utils/function";
import { is } from "./utils/is";
// @ts-expect-error idk what broke but smth did
export interface TweenOptions extends KeyframeEffectOptions {
composite?: CompositeOperation;
delay?: number;
@snuffyDev
snuffyDev / build.js
Created August 8, 2023 08:16
SLS modules
import { readFileSync, readdirSync, rmSync } from "fs";
import { readFile } from "fs/promises";
import { createRequire } from "module";
import path from "path";
import { nodeModulesPolyfillPlugin } from "esbuild-plugins-node-modules-polyfill";
import resolve from "esbuild-plugin-resolve";
import { defineConfig } from "tsup";
import { transform } from "esbuild";
const require = createRequire(import.meta.url);
This file has been truncated, but you can view the full file.
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var OBn=Object.create;var e6e=Object.defineProperty;var FBn=Object.getOwnPropertyDescriptor;var BBn=Object.getOwnPropertyNames;var VBn=Object.getPrototypeOf,UBn=Object.prototype.hasOwnProperty;var _S=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(r,o)=>(typeof require<"u"?require:r)[o]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var AC=(a,r)=>()=>(a&&(r=a(a=0)),r);var yn=(a,r)=>()=>(r||a((r={exports:{}}).exports,r),r.exports),bm=(a,r)=>{for(var o in r)e6e(a,o,{get:r[o],enumerable:!0})},MPt=(a,r,o,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let _ of BBn(r))!UBn.call(a,_)&&_!==o&&e6e(a,_,{get:()=>r[_],enumerable:!(u=FBn(r,_))||u.enumerable});return a};var hh=(a,r,o)=>(o=a!=null?OBn(VBn(a)):{},MPt(r||!a||!a.__esModule?e6e(o,"default",{value:a,enumerable:!0}):o,a)),Wd=a=>MPt(e6e({},"__esModule",{value:!0}),a);function Yit(a){throw new Error("Node.js process "+a+" is not supported by JSPM cor
@snuffyDev
snuffyDev / core_motionPath.ts
Last active July 21, 2023 21:04
Animation Library made with TypeScript
import { TweenOptions } from "./tween";
import { KeyframeWithTransform } from "./types";
import { pathStringToSVGPath } from "./utils/path";
import { buildTransform, isTransform } from "./utils/transform";
export type PathTweenOptions = TweenOptions & MotionPathOptions;
export type Anchor = NonNullable<MotionPathOptions["anchor"]>;
export type MotionPathOptions = {
path: SVGPathElement | string;
import type { ExtendedEntityV2 } from "$lib/types/core/map";
import type { Position2D } from "$lib/types/position";
type Portal = {
position: Position2D;
connectedRegion: number;
};
type Region = {
portals: Portal[];
import type {
CSSTransform,
KeyframeWithTransform as Keyframe,
KeyframeWithTransform,
} from "./types";
import { isTransform } from "./utils/transform";
import { convertUnits } from "./utils/units";
export interface TweenOptions {
composite?: CompositeOperation;
delay?: number;
function _levelStore() {
let TILES: WorldState["data"] = [];
const { subscribe, set, update } = writable<WorldState["data"]>([]);
const checkCollisionWithWorld = (
position: Position | Position2D,
isBot: boolean | null = false
) => {
const { component, attributes, blocking } = TILES[position!.z][position!.x];