@galacean/engine
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Galacean Engine

npm-size npm-download codecov

Galacean is a web-first and mobile-first high-performance real-time interactive engine. Use component system design and pursue ease of use and light weight. Developers can independently use and write Typescript scripts to develop projects using pure code.

Features

  • 🖥  Platform - Suppport HTML5 and Alipay miniprogram
  • 🔮  Graphics - Advanced 2D + 3D graphics engine
  • 🏃  Animation - Powerful animation system
  • 🧱  Physics - Powerful and easy-to-use physical features
  • 👆  Input - Easy-to-use interactive capabilities
  • 📑  Scripts - Use TypeScript to write logic efficiently

Installation

To install, use:

npm install @galacean/engine

This will allow you to import engine entirely using:

import * as GALACEAN from "@galacean/engine";

or individual classes using:

import { Engine, Scene, Entity } from "@galacean/engine";

Usage

// Create engine by passing in the HTMLCanvasElement id and adjust canvas size
const engine = await WebGLEngine.create({ canvas: "canvas-id" });
engine.canvas.resizeByClientSize();

// Get scene and create root entity
const scene = engine.sceneManager.activeScene;
const rootEntity = scene.createRootEntity("Root");

// Create light
const lightEntity = rootEntity.createChild("Light");
const directLight = lightEntity.addComponent(DirectLight);
lightEntity.transform.setRotation(-45, -45, 0);
directLight.intensity = 0.4;

// Create camera
const cameraEntity = rootEntity.createChild("Camera");
cameraEntity.addComponent(Camera);
cameraEntity.transform.setPosition(0, 0, 12);

// Create sphere
const meshEntity = rootEntity.createChild("Sphere");
const meshRenderer = meshEntity.addComponent(MeshRenderer);
const material = new BlinnPhongMaterial(engine);
meshRenderer.setMaterial(material);
meshRenderer.mesh = PrimitiveMesh.createSphere(engine, 1);

// Run engine
engine.run();

Links

License

The engine is released under the MIT license. See LICENSE file.

/@galacean/engine/

    Package Sidebar

    Install

    npm i @galacean/engine

    Weekly Downloads

    149

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    3.07 MB

    Total Files

    12

    Last publish

    Collaborators

    • chengkong.zxx
    • imchenjian
    • ruimeng.su
    • yinjie
    • yiqi
    • jujie
    • luzhuang
    • husong
    • mrkou47
    • johanzhu
    • zhuxudong
    • zhanyingwei
    • gl3336563
    • eyworldwide