Giter Site home page Giter Site logo

mykethearchangel / three.ez Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agargaro/three.ez

0.0 0.0 0.0 5.08 MB

Simplify three.js development, including events, drag & drop, binding, focus management, smart rendering, tweening and more.

Home Page: https://agargaro.github.io/three.ez/

License: MIT License

JavaScript 0.45% TypeScript 99.55%

three.ez's Introduction

three.ez

npm Quality Gate Status DeepScan grade

three.ez is a TypeScript library designed to streamline and enhance the development of three.js applications.
It provides a comprehensive suite of user-friendly tools and high-performance features.
With three.ez, you'll discover an efficient and robust toolkit for your 3D projects.

This library has only one dependency: three.js r151+.

Key Features

Feature Description
Automatic Resize Handling Automatically resizes the Renderer, Camera, and EffectComposer.
Using the viewportResize event, you can easily set the resolution for custom shaders.
Smart Rendering Optimize performance by rendering frames only when necessary, reducing computational overhead.
Simplified Multiple Rendering Effortlessly manage rendering for multiple scenes or viewports within a single canvas.
Object3D Property Binding Streamline the management of Object3D properties.
Event Programming Add interactions to Object3D through programmable events, similar to DOM events.
You can bind events for changes in position, scale, rotation, visibility, and enabled state.
Focus and Blur Enhance interactivity with focus and blur events.
Drag and Drop Seamlessly integrate drag-and-drop functionality.
Hitbox Functionality Leverage hitboxes for customized intersections or simplified calculations.
Raycasting Options Choose between continuous or mouse movement-based raycasting, optimizing intersection operations.
Tweening Create smooth animations effortlessly with built-in tweening.
Simplified InstancedMesh Manage InstancedMesh instances with the ease of working with Object3D, simplifying creation and manipulation.
Asset Management Efficiently load and manage external assets and resources for your 3D projects.

Installation

You can install three.ez via npm using the following command:

npm install @three.ez/main

Usage

import { Scene, Mesh, BoxGeometry, MeshNormalMaterial } from 'three';
import { Main, PerspectiveCameraAuto } from '@three.ez/main';

const box = new Mesh(new BoxGeometry(0.1, 0.1, 0.1), new MeshNormalMaterial());

box.draggable = true;

box.on('animate', (e) => box.rotateX(e.delta).rotateY(e.delta * 2));

box.on(['pointerover', 'pointerout'], function (e) {
    this.tween('id').to(500, { scale: e.type === 'pointerover' ? 1.5 : 1 }, { easing: 'easeOutElastic' }).start();
});

const scene = new Scene().add(box);

const main = new Main();
main.createView({ scene, camera: new PerspectiveCameraAuto(70).translateZ(1) });

Live Examples

These examples use vite, and some mobile devices may run out of memory. However, there is one example without it.

Examples Collection

Documentation

The tutorial is available here (work in progress).
The API documentation is available here.

Contributing

Any help is highly appreciated. If you would like to contribute to this package or report problems, feel free to open a bug or pull request.

Questions?

If you have questions or need assistance, you can create a discussion in the appropriate section.

three.ez's People

Contributors

agargaro avatar gabrielecoco28 avatar luigidenora avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.