Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gsimone/things

Repository files navigation

NPM Node.js CI

πŸ‘‰ You can install the packages individually or just grab the kitchensink version with everything - and leave it to treeshaking to remove unused code.

npm i @gsimone/things
import { CatenaryCurve, RaycasterHelper } from "@gsimone/things";

Packages

Three

RaycasterHelper

NPM BundlePhobia

npm i @gsimone/three-raycaster-helper

Visualize a Raycaster (ray and near/far) and, optionally, its hits.

import { RaycasterHelper } from "@gsimone/three-raycaster-helper";
const raycaster = new Raycaster(origin, direction, 0.5, 10);
const helper = new RaycasterHelper(raycaster);
const hits = raycaster.intersectObjects(scene.children);
helper.hits = hits;

Catenary Curve

NPM BundlePhobia

npm i @gsimone/three-catenary

πŸ‘‰ Codesandbox

An hyperbole that passes through 2 points, used as a good enough approximation of ropes collapsing under their own weight between two points.

import { CatenaryCurve } from "@gsimone/three-catenary";
const catenary = new CatenaryCurve(p1, p2, 10);
const myGeometry = new TubeGeometry(catenary, 100, 0.1, 20, false);

@todo add credits & tiny explaination

Smoothdamp

NPM BundlePhobia

npm i @gsimone/smoothdamp

Port of Unity's SmoothDamp.

import { SmoothDamp } from "@gsimone/smoothdamp";
import { SmoothDampVectors } from "@gsimone/smoothdamp/three";
const smoothDamp = new SmoothDamp(0.5, 10);
const x = smoothDamp.get(10, deltaTime);
// using with three.js Vectors
const mySmoothDampV = new SmoothDampVectors(0.5, 10);
const target = new Vector3(0, 0, 0);
const dest = new Vector3(10, 0, 0);
target.copy(mySmoothDampV.get(target, dest, deltaTime));

React Three Fiber

Layers

NPM BundlePhobia

npm i @gsimone/r3f-layers

Simple helper for three's Layers, lets you set an object's layers in a declarative manner:

<mesh>
 <Layers layers={[0, 1, 3]} /> {/* will set layers 0, 1 and 3 exclusively */}
</mesh>

Leva

bitmask plugin

NPM BundlePhobia

npm i @gsimone/leva-plugin-bitmask

Plugin to add a bitmask-type input. Returns a bitmask object from bitmaskjs with an additional layersArray property to get an array compatible with the πŸ”— Layers r3f component

const { layers } = useControls({
 layers: bitmask({
 value: [1, 0, 1], // sets first bit to 1, second to 0, third to 1
 size: 16,
 }),
 layers2: bitmask({
 value: 3, // sets the integer of the bitmask to 3, equivalent to [1, 1]
 }),
});
layers.layersArray; // [0]

TODO

Add alternative APIs to set the initial value.

Vanilla

Bitmask

NPM BundlePhobia

npm i @gsimone/bitmask

Tiny library for bitmasks.

const bitmask = new Bitmask([1, 0, 1], 16);
bitmask.setBit(1, 1).clearBit(2).getBits();

About

Loose collection of *things*

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /