@createjs/easeljs

中文文档
2.0.0-beta.4发布于 2018/11/22MITESM + CJS近 30 天下载 5035

The Easel JavaScript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier. Part of the CreateJS suite of libraries.

原始使用文档
文档目录5 节
  1. 2.0 BETA
  2. Installation
  3. Simple Example
  4. Sprite Animation Example
  5. Support and Resources

2.0 BETA

This branch is in beta. Reporting issues is appreciated, please mention that it is for 2.0 in the issue body.

The StageGL class went under a heavy rewrite in 1.1 which has not been ported to ES2015 syntax. We have excluded it from this branch for the time being. It will be added back when the class is finalized.

Canvas-based image comparison unit tests are known to be failing, please don't report issues for this.

easeljs

EaselJS is a library for building high-performance interactive 2D content in HTML5. It provides a feature-rich display list to allow you to manipulate and animate graphics. It also provides a robust interactive model for mouse and touch interactions.

It is excellent for building games, generative art, ads, data visualization, and other highly graphical experiences. It works well alone, or with the rest of the CreateJS suite: SoundJS, PreloadJS, and TweenJS.

It has no external dependencies, and should be compatible with virtually any framework you enjoy using.

Installation

NPM

npm install @createjs/easeljs --save

CDN

<script src="https://code.createjs.com/2.0/easeljs.min.js"></script>

Simple Example

// Draw a square on screen.
import { Stage, Shape } from "@createjs/easeljs";
let stage = new Stage("myCanvas");
let shape = new Shape();
shape.graphics.beginFill("red").drawRect(0, 0, 120, 120);
stage.addChild(shape);
stage.update();

Sprite Animation Example

import { Sprite, SpriteSheet, Ticker } from "@createjs/easeljs";
let ss = new SpriteSheet({
  frames: {
    width: 32,
    height: 64,
    numFrames: 19
  },
  animations: {run: [0, 25], jump: [26, 63, "run"]},
  images: ["./assets/runningGrant.png"]
});

let sprite = new Sprite(ss, "run");
sprite.scaleY = sprite.scaleX = 0.4;
stage.addChild(sprite);

sprite.on("click", evt => sprite.gotoAndPlay("jump"));

Ticker.on("tick", stage);

Support and Resources

  • Find examples and more information at the EaselJS web site.
  • Read the documentation.
  • Discuss, share projects, and interact with other users on reddit.
  • Ask technical questions on Stack Overflow.
  • File verified bugs or formal feature requests using Issues on GitHub.
  • There is a Google Group for discussions and support.
  • Have a look at the included examples for more in-depth instructions.

It was built by gskinner.com, and is released for free under the MIT license, which means you can use it for almost any purpose (including commercial projects). We appreciate credit where possible, but it is not a requirement.

版本与发布记录

@createjs/easeljs 共发布 4 个版本,首次发布于 2018/03/29;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.0-beta.4latest2018/11/227 年前
2.0.0-beta.32018/08/208 年前
2.0.0-beta.22018/03/298 年前
2.0.0-beta.12018/03/298 年前

关于 @createjs/easeljs 的常见问题

@createjs/easeljs 是什么?

The Easel JavaScript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier. Part of the CreateJS suite of libraries.

如何安装 @createjs/easeljs?

在项目目录运行 npm install @createjs/easeljs,或使用 pnpm add / yarn add / bun add。

@createjs/easeljs 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/createjs__easeljs 是否存在。

@createjs/easeljs 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@createjs/easeljs 可以商用吗?

@createjs/easeljs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@createjs/easeljs 的下载量有多少?

根据 npm 官方下载统计,@createjs/easeljs 在 2026/10/11 – 2026/11/09 这 30 天内被下载 5,035 次,日均约 168 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@createjs/easeljs 还在维护吗?

最新版本 2.0.0-beta.4 发布于 2018/11/22(7 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/03/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。