Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Stage.js is a 2D rendering and layout library for HTML5 Canvas. It is lightweight, fast and optimized for web and mobile game development.
Stage.js provides an API similar to DOM to create and animate optimized graphics on HTM5 2D Canvas.
// Define and preload a texture
await Stage.atlas({
image: "sample.png",
textures: {
box: { x: 0, y: 0, width: 30, height: 30 },
},
});
// Create and mount a new app
const app = Stage.mount();
// Set view box
app.viewbox(300, 200);
// Create an sprite and append it to app
const box = Stage.sprite("box").appendTo(app);
// Align box to center
box.pin("align", 0.5);
// On click...
box.on("click", function (point) {
// ...tween scale values of this node
this.tween()
.ease("bounce")
.pin({
scaleX: Math.random() + 0.5,
scaleY: Math.random() + 0.5,
});
});
<script src="https://cdn.jsdelivr.net/npm/stage-js@1.0"></script>
<script>
const app = Stage.mount();
</script>
npm install --save stage-js
const Stage = require("stage-js");
import Stage from "stage-js";
There are some backward incompatible changes in v1.0, most notably:
Stage
now is a namespace, it is not a class or callable function anymorePlease see the upgrade doc for more information.
To try examples with a live build run the following command and check the output for the URL to open in your browser:
npm run dev
Copyright 2024 Ali Shakiba Available under the MIT License
FAQs
2D HTML5 Rendering and Layout
The npm package stage-js receives a total of 447 weekly downloads. As such, stage-js popularity was classified as not popular.
We found that stage-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.