Eva.js is a front-end game engine specifically for creating interactive game projects.

Overview

Eva.js (Interactive Game Engine)

npm-version npm-size npm-download

Introduction

Eva.js is a front-end game engine specifically for creating interactive game projects.

Easy to Use: Eva.js provides out-of-box game components for developers to use right away. Yes, it's simple and elegant!

High-performance: Eva.js is powered by efficient runtime and rendering pipeline (Pixi.JS) which makes it possible to unleash the full potential of your device.

Scalability: Thanks to the ECS(Entity-Component-System) structure, you can expand your needs by highly customizable APIs. The only limitation is your imagination!

Documentation

You can find the Eva.js Documentation on eva.js.org, we appreciate your devotion by sending pull requests to this repository.

Checking out the Live example.

Usage

Install

npm i @eva/eva.js @eva/plugin-renderer @eva/plugin-renderer-img --save

Example

<canvas id="canvas" >canvas>
import { Game, GameObject, resource, RESOURCE_TYPE } from '@eva/eva.js';
import { RendererSystem } from '@eva/plugin-renderer';
import { Img, ImgSystem } from '@eva/plugin-renderer-img';

resource.addResource([
  {
    name: 'imageName',
    type: RESOURCE_TYPE.IMAGE,
    src: {
      image: {
        type: 'png',
        url:
          'https://gw.alicdn.com/tfs/TB1DNzoOvb2gK0jSZK9XXaEgFXa-658-1152.webp',
      },
    },
    preload: true,
  },
]);

const game = new Game({
  systems: [
    new RendererSystem({
      canvas: document.querySelector('#canvas'),
      width: 750,
      height: 1000,
    }),
    new ImgSystem(),
  ],
});

const image = new GameObject('image', {
  size: { width: 750, height: 1319 },
  origin: { x: 0, y: 0 },
  position: {
    x: 0,
    y: -319,
  },
  anchor: {
    x: 0,
    y: 0,
  },
});

image.addComponent(
  new Img({
    resource: 'imageName',
  })
);

game.scene.addChild(image);

Questions

For questions and support please use Gitter or DingTalk (钉钉) to scan this QR Code.

Issues

Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

Changelog

release notes in documentation.

Contribute

How to Contribute

License

The Eva.js is released under the MIT license. See LICENSE file.

Comments
  • lottie无法设置大小,点击区域不正确

    lottie无法设置大小,点击区域不正确

    lottie无法设置大小,点击区域不正确

    const go = new GameObject('heart', {
         size: { width: 200, height: 200 }, // 不生效
    })
    

    绑定onTap事件后,只能在左上角触发点击事件

    在lottieFiles上下载的lottie json文件,本地引入

    Lottie.prototype.onTap = function (name, callback) {
            var _this = this;
            var g = new Graphics();
            this.on('success', function () {
                var ele = _this.anim.querySelector(name);
                var display = ele.display;
                g.beginFill(0xffffff);
                g.drawRect(0, 0, 100, 100);  // 感觉应该跟这里有关
                g.endFill();
                g.alpha = 0;
                display.addChild(g);
                ele.display.interactive = true;
                ele.display.on('pointertap', function () {
                    callback();
                });
            });
        };
    

    另外文档能否更详细一点,比如具体如何进行适配

    • Eva.js version: e.g. 1.2.4
    • Browser & Version: e.g. Chrome 96
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by KevinIvy 14
  • feat: executionOrder

    feat: executionOrder

    Please check if the PR fulfills these requirements

    • [ ] The commit message follows our guidelines
    • [ ] Tests for the changes have been added (for bug fixes / features)
    • [ ] Docs have been added / updated (for bug fixes / features)

    What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

    What is the current behavior? (You can also link to an open issue here)

    What is the new behavior (if this is a feature change)?

    Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

    Other information:

    opened by SLI97 11
  • resource.destory()动态删除资源时报错(删除没有用到的资源)

    resource.destory()动态删除资源时报错(删除没有用到的资源)

    Expected Behavior

    resource.destory(),动态删除

    Current Behavior

    删除resource.destory() 资源报错 WX20211215-162252

    Possible Solution

    是因为我还在用这个资源吗?我这边是用户长链接进来的一些头像、名称的资源,我想用户下去之后删除头像名称资源

    Steps to Reproduce

    WX20211215-162515 image

    Environment

    • Eva.js version: e.g. 1.1.6
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by WuZheXiao 6
  • 帧动画播放完后,又重现回到了第一帧。预期能够停在最后一帧。

    帧动画播放完后,又重现回到了第一帧。预期能够停在最后一帧。

    Expected Behavior

    需求: 播放完一段帧动画后,接着播放另一段帧动画。需要两个动画动作衔接流畅。

    Current Behavior

    播放完一段帧动画后,直接初始到了第一帧,然后播放第二段动画时,无法衔接一起,无法与第一段动画衔接

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: e.g. 1.0.0
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by ai-blib 5
  • touchmove相关问题

    touchmove相关问题

    1.手势不在当前物体上 move 也会触发。如给一个元素绑定move事件后,鼠标或者手势不在当前元素时仍会触发 2.多个元素绑定时,仅在一个元素内移动,其他元素也会触发move 3.EVA.plugin.renderer.event.js中container.on('pointermove', function (e) {} e.target PC端有而移动端为null

    enhancement 
    opened by daiqiaojun 4
  • 微信小游戏里如何引用了eva.js了

    微信小游戏里如何引用了eva.js了

    web小白想尝试下直接在微信小游戏中引入eva.js

    但是目前没有任何教程,希望大佬们能出个建议的教程

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: e.g. 1.0.0
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by ninglei1993 3
  • @eva/plugin-matterjs 开源问题

    @eva/plugin-matterjs 开源问题

    Expected Behavior

    @eva/plugin-matterjs 是否考虑开源(原始 ts 的那个版本, npm cjs 版本是打包后的版本),最近生产中有需要用到 matterjs 中的梯形绘制特性部分,希望在该 plugin 上做进一步修改或参考该 plugin 自己实现之类

    Current Behavior

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: 1.2.7
    • Browser & Version: Chrome 103
    • OS & Version: Win 10
    • Running Example: none
    opened by wujohns 3
  • 如何加载本地项目资源,例如json,本地图片?

    如何加载本地项目资源,例如json,本地图片?

    Expected Behavior

    resource.addResource([
        {
            name: 'imageName',
            type: RESOURCE_TYPE.IMAGE,
            src: {
                image: {
                    type: 'png',
                    url: 'https://gw.alicdn.com/tfs/TB1DNzoOvb2gK0jSZK9XXaEgFXa-658-1152.webp',
                    // url:'./test_png.webp',
                },
            },
            preload: true,
        },
    ]);
    

    Current Behavior

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: e.g. 1.0.0
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by huiruo 3
  • addComponent(new Event()) 报错

    addComponent(new Event()) 报错

    Expected Behavior

    Current Behavior

    image 代码:const evt = po.addComponent( new Event() ) 只要已执行这一句就会报错;

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: e.g. 1.0.0
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by ipengkai 3
  • 开发和打包时的依赖报错

    开发和打包时的依赖报错

    问题:vue3+ts+vite开发环境下报错

    Uncaught ReferenceError: global is not defined requestAnimationFrame.js:24 at requestAnimationFrame.js:24

    打包时也报了一些ts类型错误、pixi.js的错误

    Environment

    • EVA.js version: 1.0.4
    • Browser & Version: chrome90(arm64
    • OS & Version: macos bigsur 11.2.3
    • Running Example: 无法正常打包发布,555,https://github.com/Congb19/congb19-top/blob/main/src/pages/game.vue
    opened by Congb19 3
  • 修改gameObject transform后,pixi.js worldTransform 没有同步更新

    修改gameObject transform后,pixi.js worldTransform 没有同步更新

    Expected Behavior

    Current Behavior

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: e.g. 1.0.0
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by lidongjies 2
  • 骨骼动画Spine,切换第二个源的时候,产生残影的Bug

    骨骼动画Spine,切换第二个源的时候,产生残影的Bug

    Expected Behavior

    骨骼动画Spine,切换第二个源的时候,正常的spine

    Current Behavior

    骨骼动画Spine,切换第二个源的时候,产生残影的Bug

    Possible Solution

    切换第二个源的时候,还是第一个源的信息

    Steps to Reproduce

    Environment

    uniapp中的renderjs环境

    截图: b3ef486472d15bb434d8cf7febe8be1

    56dc42e8bc6d987b7bf8de691df057f

    静态资源: static.zip

    主代码: AnimAmy.zip

    • **Eva.js version v1.3.0-alpha.1
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    opened by benweng 10
  • feat/setTimeout

    feat/setTimeout

    Please check if the PR fulfills these requirements

    • [ ] The commit message follows our guidelines
    • [ ] Tests for the changes have been added (for bug fixes / features)
    • [ ] Docs have been added / updated (for bug fixes / features)

    What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

    What is the current behavior? (You can also link to an open issue here)

    What is the new behavior (if this is a feature change)?

    Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

    Other information:

    enhancement 
    opened by terrykingcha 0
  • eva上lottie文本无法显示,lottie-web,官网预览正常显示。

    eva上lottie文本无法显示,lottie-web,官网预览正常显示。

    Expected Behavior

    播放lottie动画,文本图层正常显示。

    Current Behavior

    eva编译lottie文件文本无法正常显示,而在其他地方预览文本正常显示。eg:lottie官网预览,lottie-web上

    Possible Solution

    是否是eva引用文件版本冲突问题

    Steps to Reproduce

    在vue2.0中,正常npm安装eva,后引入lottie模块,lottie引用state本地文件

    Environment

    • Eva.js version: 1.2.7_
    • Browser & Version: Chrome 99.0.4844.51(正式版本) (64 位)
    • OS & Version: Window10 OS版本 : 14393.5006
    • Vue.js version: 2.6.14_
    • @eva/plugin-renderer-lottie version: 1.2.7_
    • lottie-web version: 5.9.6_

    0d4fbc8f2d2a87416d634460b6fe3e9 45b4821df7d0b5cd3d323e8b43a67b9

    opened by Norrfor 0
  • 增加对 BitmapText 的支持

    增加对 BitmapText 的支持

    Expected Behavior

    数值UI 等需求有时需要用到位图字体。 希望 增加对 BitmapText 的支持 (pixi 本身是支持的), 希望 resource 增加对 BitmapText 依赖资源的加载支持 (xml),且能支持多位图字体集(多位图字体 合并一张png)就更好了

    Current Behavior

    Possible Solution

    Steps to Reproduce

    Environment

    • Eva.js version: e.g. 1.0.0
    • Browser & Version: e.g. Chrome 67
    • OS & Version: e.g. MacOS 10.15.7
    • Running Example: url
    enhancement 
    opened by zfkun 0
  • feat/system

    feat/system

    Please check if the PR fulfills these requirements

    • [ ] The commit message follows our guidelines
    • [ ] Tests for the changes have been added (for bug fixes / features)
    • [ ] Docs have been added / updated (for bug fixes / features)

    What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

    What is the current behavior? (You can also link to an open issue here)

    What is the new behavior (if this is a feature change)?

    Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

    Other information:

    enhancement 
    opened by terrykingcha 1
Releases(v1.2.8)
  • v1.2.8(Sep 29, 2022)

    What's Changed

    • Fix: #200 by @terrykingcha in https://github.com/eva-engine/eva.js/pull/201
    • Fix: typo for enableScroll of RendererSystemParams by @zfkun in https://github.com/eva-engine/eva.js/pull/206
    • Fix: mask by @fanmingfei in https://github.com/eva-engine/eva.js/pull/199
    • Fix: a shim of Object.values by @fanmingfei in commit a9740c
    • Fix: Remove Dragonbone Ticker on destroy by @terrykingcha in commit 83ed7a
    • Fix: Remove Sprite Images on destroy by @terrykingcha in commit 9b071b

    New Contributors

    • @zfkun made their first contribution in https://github.com/eva-engine/eva.js/pull/206

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.7...v1.2.8

    Source code(tar.gz)
    Source code(zip)
  • v1.2.7(Feb 25, 2022)

    What's Changed

    • Fix: export settings/UPDATE_PRIORITY from miniprogram-pixi by @fanmingfei in https://github.com/eva-engine/eva.js/pull/184
    • Fix: bad component resource by @aspsnd in https://github.com/eva-engine/eva.js/pull/183
    • Feat: add draw call at stats plugin by @574495412 in https://github.com/eva-engine/eva.js/pull/178

    New Contributors

    • @574495412 made their first contribution in https://github.com/eva-engine/eva.js/pull/178

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.6...v1.2.7

    Source code(tar.gz)
    Source code(zip)
  • v1.2.6(Feb 17, 2022)

    What's Changed

    • fix: IIFE min file not have window variable. by @fanmingfei in https://github.com/eva-engine/eva.js/pull/185

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.5...v1.2.6

    Source code(tar.gz)
    Source code(zip)
  • v1.2.5(Dec 21, 2021)

    What's Changed

    • fix: throw error addComponent to a destroyed gameObject by @fanmingfei in https://github.com/eva-engine/eva.js/pull/174

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.4...v1.2.5

    Source code(tar.gz)
    Source code(zip)
  • v1.2.4(Dec 17, 2021)

    What's Changed

    • fix: lottie destroy https://github.com/eva-engine/eva.js/pull/171
    • fix: dragonbone ticker https://github.com/eva-engine/eva.js/pull/171
    • fix: Keeping the behavior of v1.2.1 https://github.com/eva-engine/eva.js/pull/171

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.3...v1.2.4

    Source code(tar.gz)
    Source code(zip)
  • v1.2.3(Dec 14, 2021)

    What's Changed

    • fix: observer by @fanmingfei in https://github.com/eva-engine/eva.js/pull/168

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.2...v1.2.3

    Source code(tar.gz)
    Source code(zip)
  • v1.2.2(Dec 14, 2021)

    What's Changed

    • fix: change error to console by @fanmingfei in https://github.com/eva-engine/eva.js/pull/155
    • Feat/spine bundle by @fanmingfei in https://github.com/eva-engine/eva.js/pull/154
    • Fix/iife by @fanmingfei in https://github.com/eva-engine/eva.js/pull/153
    • feat: frame info & stop at last frame by @fanmingfei in https://github.com/eva-engine/eva.js/pull/151
    • add localPosition on event data by @aspsnd in https://github.com/eva-engine/eva.js/pull/158
    • Fix/frame by @fanmingfei in https://github.com/eva-engine/eva.js/pull/159
    • Feat/ali miniprogram by @fanmingfei in https://github.com/eva-engine/eva.js/pull/156
    • fix: qrcode by @fanmingfei in https://github.com/eva-engine/eva.js/pull/162
    • Spine autoplay bug by @aspsnd in https://github.com/eva-engine/eva.js/pull/164
    • fix: resource can't loaded by @fanmingfei in https://github.com/eva-engine/eva.js/pull/165
    • fix: protect by @fanmingfei in https://github.com/eva-engine/eva.js/pull/166
    • fix: remove symbol by @fanmingfei in https://github.com/eva-engine/eva.js/pull/167

    Full Changelog: https://github.com/eva-engine/eva.js/compare/v1.2.0...v1.2.2

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Nov 8, 2021)

    Feature

    • Support compressed texture Fixed
    • Optimize a11y
    • Solve the problem that spine38 uses the same resource to delete and immediately add an error
    Source code(tar.gz)
    Source code(zip)
  • v1.1.15(Nov 8, 2021)

  • v1.1.14(Sep 24, 2021)

  • v1.1.13(Sep 24, 2021)

  • v1.1.11(Sep 24, 2021)

  • v1.1.7(Sep 5, 2021)

  • v1.1.6(Sep 5, 2021)

  • v1.1.4(Sep 5, 2021)

  • v1.1.3(Aug 24, 2021)

  • v1.1.2(Aug 24, 2021)

    Feature

    • Devtool feature
    • vite TS tip (#95)

    Fixed

    • Event type intelligence (#94)
    • Bug when mouse.open=true (#101)
    • Provide information for devtools (#88)
    • Transition play type definition (#99)
    • Skip other deps version (767e30)
    • Hit error when isTest=false (#113)
    • Spine3.8 mesh bug (#115)
    • Spine change skin bug (#97)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Aug 10, 2021)

  • v1.1.0(Aug 9, 2021)

  • v1.0.13(Aug 9, 2021)

  • v1.0.12(Aug 3, 2021)

  • v1.0.11(Jul 31, 2021)

  • v1.0.10(Jul 31, 2021)

  • v1.0.9(Jul 31, 2021)

  • v1.0.8(Jul 1, 2021)

    Feature

    Adding polygon body for Matterjs plugin (#61) Enhancement spriteAnimation (#52) Chinese Readme

    Fixed

    Move pixi ticker to lateUpdate. #58 (#59) Lost frame bug #25 (#50) Try catch checkA11yOpen #48 (#55)

    Source code(tar.gz)
    Source code(zip)
A lightweight 3D game engine for the web.

A lightweight 3D game engine for the web. Built with three.js and cannon-es.

null 667 Dec 31, 2022
LittleJS Logo LittleJS - The Tiny JavaScript Game Engine That Can

The Tiny JavaScript Game Engine That Can! ??

Frank Force 2.4k Dec 31, 2022
🎮 Excalibur is a free game engine written in TypeScript for making 2D games in HTML5 canvas

?? An easy to use 2D HTML5 game engine written in TypeScript

Excalibur.js 1.3k Dec 30, 2022
Latin Wordle is a free and open-source project that aims to provide a fun and interactive way to learn Latin.

Latin Wordle Live Game Here Inspiration Latin Wordle is a free and open-source project that aims to provide a fun and interactive way to learn Latin.

null 15 Dec 16, 2022
WordleGameCB - a game inspired by the Wordle word game developed by Josh Wardle

Technologies WordleGameCB WordleGameCB is a game inspired by the Wordle word game developed by Josh Wardle. This application was developed with the ai

@Encoding 4 Feb 20, 2022
🏎 Open source racing game developed by everyone willing

?? Open source racing game developed by everyone willing

Poimandres 2k Dec 26, 2022
Golf it! is a game designed to let you show off your code-fu by solving problems

Golf it! Golf it! is a game designed to let you show off your code-fu by solving problems in the least number of characters ✨ Explore the docs » View

Ashikka Gupta 5 Aug 18, 2022
Pig is a simple two player dice game.

Pig game Pig is a simple two player dice game. Play here: formidablae.github.io/pig_game or formaidablae-pig-game.netlify.app Each turn, a player repe

null 10 Oct 5, 2022
Quizpetitive - A quiz game to learn new knowledge and terms in the field of project management.

Quizpetitive A quiz game to learn new knowledge and terms in the field of project management. The key element to the success of this project was the c

LMF 1 May 16, 2022
Bitburner Game

Bitburner Bitburner is a programming-based incremental game that revolves around hacking and cyberpunk themes. The game can be played at https://danie

null 2.6k Dec 30, 2022
A clone of the popular Wordle game.

Wordle Clone How to play locally: yarn install

null 2 Jan 9, 2022
A clone of the popular game Wordle made using React, Typescript, and Tailwind

Wordle Clone Go play the real Wordle here Read the story behind it here Try a demo of this clone project here Inspiration: This game is an open source

Hannah Park 2.4k Jan 8, 2023
🎩 2048 game is cloned with ReactJS, CSS3.

2048-react This is a clone of 2048 implemented using React. It's running live here. The game logic is implemented in ./src/components/mainBoard.jsx. I

Arham 7 Jul 31, 2022
A tiny game to practice AoE building shortcuts.

Aegis A tiny game to practice Age of Empires IV building shortcuts. Using ⚛️ Create-React-App and ?? Zustand. License With the exception of all visual

Alexander Widua 30 Jan 1, 2023
Provides 5 keywords with which to narrow down your wordle game. I ruin nice things.

Widdle?? I hate fun so I wrote a script that ruins Wordle. This script can be used to find a Widdle, a set of five words that cover nearly all letters

Tess Myers 3 Mar 12, 2022
WORDLEBOARD prototype: Show your Wordle game on a Vestaboard as you play.

WORDLEBOARD prototype Show your Wordle game on a Vestaboard as you play. Copyright (c) 2022, Scott Schiller. MIT license. Made with love and fun in mi

Scott Schiller 7 Dec 20, 2022
Snake game using pure HTML, CSS and JavaScript with GameBoy look and feel using Nano editor

Snake game using pure HTML, CSS and JavaScript with GameBoy look and feel using Nano editor. 100% commented code in Portuguese

Gabriel Martins 2 Jul 2, 2022
EarthDefender is a simple personal project JS game

EarthDefender is a simple personal project JS game, the goal of it is to stop the meteors from hitting Earth.

Svetoslav Zhekov 2 Jan 25, 2022
A Wordle-like game where you have to guess the unsigned 8-bit binary number

Bytle A Wordle-like game where you have to guess the unsigned 8-bit binary number! Game coded in 2h 14m 50.570s, but it's not like I'm counting how lo

James Livesey 16 Jun 30, 2022