0.0.4 • Published 1 year ago

sculpty v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

sculpty

npm-version

Installation

npm install sculpty

Basic usage

import { World } from 'sculpty';
import { PerspectiveCamera, Scene, sRGBEncoding, WebGLRenderer } from 'three';

const aspect = window.innerWidth / window.innerHeight;
const camera = new PerspectiveCamera(75, aspect, 0.1, 1000);
const renderer = new WebGLRenderer({ antialias: true });
renderer.outputEncoding = sRGBEncoding;
renderer.setSize(window.innerWidth, window.innerHeight);
document.getElementById('renderer').appendChild(renderer.domElement);

const scene = new Scene();
const world = new World();
world.update(Array.from({ length: 20 }, (_, i) => ({
  x: i - 10, y: Math.floor(Math.sin(i * 0.5) * 2), z: -10,
  r: 255, g: 255, b: 255,
  value: 255,
})));
scene.add(world);

renderer.setAnimationLoop(() => {
  renderer.render(scene, camera);
});

Examples

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago