npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

three.modifiers

v2.5.7

Published

This is a library of modifiers for three.js objects. A modifier is an function used to modify a 3d object.

Downloads

60

Readme

Threejs mesh modifiers

A Three.js mesh morph modifier, including nearly ten modifiers, such as Bend, Bloat, Noise, Skew and Taper, etc. It is very lightweight and simple to use, using it can give you unexpected results.

Note: The latest version uses BufferGeometry to calculate, because three.js removes THREE.Geometry. If you are using a version earlier than three.js r125, please use three.modifiers v2.2.3

npm install three three.modifiers --save

Demo

Modifiers

  • Bend – bends on object along an axis
  • Bloat – Bloats the mesh by forcing vertices out of specified sphere
  • Break
  • Cloth - displaces object vertices giving the effects of wind and gravity.
  • Noise – deforms an object in a random manner
  • Pivot - Pivot is a modifier that changes an object's pivot point.
  • Skew – skews an object along one or more axes
  • Taper - displaces object vertices on two axes in proportion to their position on the third axis.
  • Twist – twists the mesh around it’s center point
  • Wheel
  • UserDefined - the custom modifier

Installing

Insert script

Download the build at dist/modifiers.min.js and include it as a script tag in a web page. You must include three.js as well.

<script src="./js/three.min.js"></script>
<script src="./js/modifiers.min.js"></script>

Use npm package

Note you must also have three installed via npm.

import * as THREE from "three";
import {
  ModifierStack,
  Twist,
  Noise,
  Cloth,
  UserDefined,
  Taper,
  Break,
  Bloat,
  Vector3,
  ModConstant
} from "three.modifiers";

Usage

const modifier = new ModifierStack(mesh);

const bend = new Bend(1.5, 0.2, 0);
bend.constraint = ModConstant.LEFT;

const cloth = new Cloth(1, 0);
cloth.setForce(0.2, -0.2, -0.2);

const twist = new Twist(0);
twist.vector = new Vector3(0, 1, 0);

const taper = new Taper(1);
taper.setFalloff(0.1, 0.5);

modifier.addModifier(bend);
modifier.addModifier(cloth);
modifier.addModifier(twist);
modifier.addModifier(taper);

// animate func
function animate() {
  requestAnimationFrame(animate);
  renderer.render(scene, camera);
  // modifier.apply
  modifier && modifier.apply();
}

Document

It is the typescript version of the ActionScript engine AS3Dmod. You can find the documentation here.

Development and Build

// DEVELOPMENT MODE
npm install
npm run demo
// (vist http://localhost:8888/)

// PRODUCTION MODE
npm run build

License

This library is under the BSD License.