r/pixijs • • Aug 29 '26

I built pixi.js based AI Video Editor

2 Upvotes

Hey everyone, I’ve been working on an AI video editor built with PixiJS.

I’m using PixiJS for the editor/rendering side and adding AI features on top of it.

Thought I’d share it here since PixiJS has been a big part of the project. Would love to hear what you guys think!


r/pixijs • • Mar 31 '25

Is anyone having success with making Pixi.js components using LLM code generation?

1 Upvotes

Gemini 2.5 Pro is supposedly best at code generation, with training cut-off in January of 2025, but it seems it has a lot of trouble generating a functioning Pixi.js v8 prototype (that interfaces with a React v19 app using @pixi/react v8) - even when I include the docs in context.

Claude 3.7 Sonnet doesn't perform much better.

Does anyone have a different experience? Any tips? LLM cheatsheets?


r/pixijs • • Aug 19 '26

I built a full 2D web-based game engine and map editor using React, Vite, and PixiJS

3 Upvotes

Hi everyone!
I'm Ste, a developer with a lifelong passion for game development.

I started making games about 20 years ago using RPG Maker. Since then I've played around with Unity and Godot too, but RPG Maker has always had a special place for me because of how simple and fun it is to use.

Recently I went back to RPG Maker to give a makeover to some games I'd released years ago on Steam. Working with it again reminded me of everything I love about it, but also of some of its limitations. That's basically how this project started.
After months of development, I'm ready to share it 😊

RPG Weaver is a 2D, web-based game engine inspired by RPG Maker. My goal is simple: keep everything that makes RPG Maker great and easy to use, while adding the features and quality-of-life improvements I've always wished it had.

Since I'm a frontend developer (7+ years of experience) and work with React every day, React was the obvious choice for building the editor. For rendering, I'm using PixiJS (the same engine RPG Maker MV/MZ uses under the hood).

Some key features RPG Maker doesn't have:

  • Multi-tile events: events are no longer stuck inside a single 1Γ—1 tile. You can define multi-tile touch boundaries using the Rectangle Tool

  • Stacked events: events can be placed on top of one another, on the same tile

  • Easy bars using pictures: the Crop Picture command lets you set a picture's width and height based on a variable, making HP/MP bars trivial

  • Unlimited map layers: use as many layers as you need, with no cap, and freely reorder them to control sorting priority

  • Pixel movement: movement is no longer locked to tile-by-tile; move freely at the pixel level

  • Customizable game inputs: easily reassign keys and define your own inputs

  • Events that follow other events: make events follow or flee other events using the familiar "Move Towards" command in the Movement Route

  • Camera control: no longer locked to the player; choose the player or any other map event as the camera's target

  • Message typewriting: a built-in typewriter effect for messages, with fully customizable windows

  • And more.

Plus all the features you already know and love from RPG Maker:

  • Autotiles and animated tiles (with configurable frame count and animation speed)

  • Tileset passage flags

  • Map transfers (including transferring other events between maps)

  • An organized resource manager (with filtering to quickly find your imported assets)

  • Switches, variables, self-switches... and even self-variables!

  • A full set of the event commands you already know.

Not yet supported, but coming soon:

  • Battle system

  • Weather effects

  • Animation management

  • Party management

Other things planned:

  • Easy importing of existing RPG Maker games

  • Desktop build export

  • Events Factory: a centralized configurator for creating reusable event templates across any map

RPG Weaver is completely free to use and still actively in development, so you might run into bugs or unfinished features. That said, I'd love to get feedback from other devs (especially fellow RPG Maker users!)

What features do you wish RPG Maker had? What's always annoyed you? Is there something you think RPG Weaver should definitely support? I'm very open to suggestions and want to shape the engine around what people actually need.

If you have a few minutes, give it a try and let me know what you think. Any feedback is genuinely appreciated. Thanks! 🀘

πŸ‘‰ https://rpg-weaver.web.app/


r/pixijs • • Oct 04 '25

why use pixi instead of phaser?

1 Upvotes

i was undecided between pixi and phaser back then. but i was told recently that pixi might be a better option afterall. im a gamedev so i make games mostly.


r/pixijs • • Aug 08 '26

Open source Mood Wheel using Pixi JS. MIT licensed, agent-friendly. Go ahead, use it

2 Upvotes

r/pixijs • • Jul 03 '26

Fable is insane at code, Codex for visuals

Post image
0 Upvotes

r/pixijs • • Feb 19 '26

URGENT: Seeking Elite Slot Graphic Designer (Spine 2D Expert)

0 Upvotes

🎯 The Vision

We are building a premium slot experience with top-tier studio quality, strong visual tension, and high-end polish.

This is NOT a casual project.
We are looking for someone capable of delivering ultra high-end animated slot assets at a true professional studio level.

🎨 WHO WE NEED (GRAPHICS ONLY)

We are looking for a Lead Slot Graphic Designer / Spine Animator who can handle EVERYTHING related to the visual side of the slot.

You must be able to deliver:

🎰 Symbols (Spine 2D – Ultra Quality)

  • Fully animated symbols built in Spine 2D

  • Clean hierarchy & professional rigging

  • Multiple states per symbol:

    • Idle

    • Land

    • Win

    • Anticipation (if needed)

  • High-value symbols with detailed skeletal animation

  • Smooth blending between animation states

🌍 Animated Background (Multi-Layer Spine)

  • Full animated background built in multiple Spine layers

    • Deep background (sky / environment)

    • Mid layer (moving elements – fog, birds, particles, etc.)

    • Foreground elements integrated with reels

  • Subtle ambient motion even when idle

  • Parallax-ready structure

  • Clean export for engine integration

πŸ’₯ Win & FX Animations

  • Big Win animations

  • Reel impact animations

  • Scatter / Bonus trigger animations

  • Animated overlays

  • Symbol glow / burst effects

  • Coin / particle-style FX (ready for engine integration)

Everything must feel:

  • Heavy

  • Juicy

  • High tension

  • Premium casino quality

βš™οΈ Technical Requirements

  • Mastery of Spine 2D

  • Clean export (JSON / .skel optimized)

  • Optimized atlas usage

  • Proper naming conventions

  • Production-ready asset structure

  • Experience working with PixiJS integration is a plus

❗ IMPORTANT

We are NOT looking for:

  • Static Illustrator-only artists

  • Basic sprite sheet animators

  • Hobby-level motion designers

We need someone who understands:

  • Slot psychology

  • Visual anticipation

  • Impact timing

  • Reel tension pacing

  • Studio-grade polish

If you have worked on real-money slot projects, that is a big advantage.

πŸ“© How to Apply

DM with:

  • Portfolio (Spine work mandatory)

  • Previous slot projects (if any)

  • Your availability (this is urgent)

  • Estimated timeline for a full slot visual package

We are building something serious.
If your work matches true studio-level quality, let’s talk immediately.


r/pixijs • • Dec 27 '25

I made a Solitaire puzzle where you can create puzzle levels by your own images!

Thumbnail reddit.com
0 Upvotes

r/pixijs • • Aug 12 '24

How to choose between pixi-react and react-pixi-fiber?

0 Upvotes

I want to integrate Pixi.js into a React page, do I need to choose between pixi-react and react-pixi-fiber, what are the decision criteria?

IMPORTANT:. I don't want to use the React declarative style for the Pixi component. Do I really need pixi-react or react-pixi-fiber or something else?

I want use use Pixi and it's draw loop just as usual... So, how do I proceed if I want it in a REACT page?


r/pixijs • • Apr 26 '25

Looking to Buy PixiJS v7 or Higher Games Available for Sale

1 Upvotes

Looking for pixijs 7 or higher + typescript games available for sale - ready to buy.

If you have games available for sale, please share a link to the game (and \ or if there is a link to github repo). Looking for casual game mechanics built on this stack, ready to buy for a reasonable price.


r/pixijs • • Apr 20 '25

Does Pixi.js work on a Raspberry?

1 Upvotes

I tried the official Pixi.js website CDN.

I tried downloading version 8.9.1 of pixi.min.js from the official website.

I tried installing node.js and then accessing the project in Visual Studio with an integrated terminal and installing pixi.js with npm.

Nothing worked. I get an error saying "Cannot read properties or Pixi is not started," or it simply doesn't give an error but doesn't display anything.

All the code I've tested is from the official website, basic code to display a window in a color.

I used to use canvas.


r/pixijs • • Aug 22 '16

Big #PixiJS news on the way very, very soon...

Thumbnail
twitter.com
1 Upvotes

r/pixijs • • Mar 28 '17

[HIRING] Looking for a pixi js dev for poker game

1 Upvotes

Looking for a talented dev to create a Poker Texas Holdem game using javascript. The game must integrate with an external API that will have access to the user's name, avatar and poker logic.

Your job will consist of creating the game with the supplied art.

Most of the game logic will be done in the backend, and our backend dev is more than willing to help with this.


r/pixijs • • Oct 25 '19

How Paint the arrow to link by n.graph.ngraph?

1 Upvotes

Hello Guys, I have a problem with ngraph.pixi and the pixi.js,

I so paint the direct graph, so I do paint the arrow to the line, I'm new with the pixi.js and the javascript and I want to learn it, can you help me how I can paint an arrow to it, please?

This is a demo and I want to add the arrow to the link.

This is the code for paint the link, inside this class

module.exports = function (link, ctx) {
  ctx.lineStyle(link.width, 0x333333, 1);
  ctx.moveTo(link.from.x, link.from.y);
  ctx.lineTo(link.to.x, link.to.y);
}

This is the complete code

module.exports.main = function () {
  var graph = require('ngraph.generators').balancedBinTree(5);
  var createPixiGraphics = require('../');

  var setting = {
    rendererOptions: {
      backgroundColor: 0xFFFFFF,
      antialias: true,
    }
  }

  var pixiGraphics = createPixiGraphics(graph, setting);
  pixiGraphics.createLinkUI(require('./lib/createLinkUI'));
  pixiGraphics.renderLink(require('./lib/renderLink'));
  pixiGraphics.createNodeUI(require('./lib/createNodeUI'));
  pixiGraphics.renderNode(require('./lib/renderNode'));
  var layout = pixiGraphics.layout;

  // just make sure first node does not move:
  layout.pinNode(graph.getNode(1), true);

  // begin animation loop:
  pixiGraphics.run();
}

The link for reproducing the code is here

The issue have an aswer by developer of ngraph to stackoverflow https://stackoverflow.com/a/58573859/10854225


r/pixijs • • 4d ago

Pidgeon Pocket, a pixel-art incremental I built with PixiJS, now has a free demo you can play in the browser

1 Upvotes

It's TypeScript and PixiJS, and the browser demo is built from the same codebase and version as the desktop game. You aim your pigeons at tourists in a park, dodge the cops and spend the coins on a bigger flock. Free demo on itch: https://lianes8.itch.io/pidgeon-pocket

Anyone else here shipping PixiJS games on itch? Did you run into anything browser-specific?


r/pixijs • • Feb 22 '26

Trying to build a canvas based on Nodes system with pixijs

1 Upvotes

Trying to build an interractive canvas with node based system like reactFlow (a simple version ), with more gpu acceleration

im in the process of adding these features :
- drag drop, zooming,
- rendering rectangles hirarchy,
- adding connections,
- elemets selection and movments,
- simple drawings

i have seen many different implementations and new docs updates on the library,
so i would love to hear the community suggestions for better approaching those problems,

Questions:

- im building inside a react app but having issues with pixi-react abstracted layer,
is it better to do it with pixijs only ?
- which specefic components of the library helps with which feature?
- should i rely on pixi-viewport for the camera interactivity ?

Im just wrapping my head around the workflow before diving into serious building.


r/pixijs • • Jun 15 '26

I got tired of fighting my tooling, so I built my own PixiJS DevTools extension

Thumbnail reddit.com
0 Upvotes

r/pixijs • • Apr 21 '25

At my wits end, Erase Blend Mode ("erase") Not Working When Rendering Graphics.

0 Upvotes

I am attempting to implement a drawing application using a `PIXI.RenderTexture` as the drawing surface, displayed via a `PIXI.Sprite`. Drawing works correctly using a `PIXI.Graphics` object ("pen") rendered to the texture.

However, when trying to implement an eraser using a separate `PIXI.Graphics` object ("eraser") with `blendMode = "erase"`, the blend mode does not seem to take effect when rendering this eraser `Graphics` object to the `RenderTexture`. Instead of creating transparent areas, it draws normally using the fill/stroke color defined for the eraser shape.

  1. Initialize a `PIXI.Application`.

  2. Create a `PIXI.RenderTexture` (e.g., `rt`).

  3. **(Optional but recommended):** Explicitly clear the `rt` once after creation using `renderer.render({ container: new PIXI.Graphics(), target: rt, clear: true })` to ensure it starts transparent.

  4. Create a `PIXI.Sprite` from the `rt` and add it to the stage.

  5. Create a `PIXI.Graphics` object for erasing (e.g., `eraserGraphics`).

  6. Set `eraserGraphics.blendMode = "erase";`.

  7. In response to a user action (e.g., pointer move):

a. Explicitly set `eraserGraphics.blendMode = "erase";` again (defensive check).

b. Define a shape on `eraserGraphics` using the modern v8 API (e.g., `.moveTo(x1, y1).lineTo(x2, y2).stroke({ color: 0xffffff, width: 10, alpha: 1 })` or `.rect(x, y, 1, 1).fill({ color: 0xffffff, alpha: 1 })`). Use a visible color like white (`0xffffff`) or even red (`0xff0000`) for testing.

c. Render `eraserGraphics` to the `RenderTexture`: `app.renderer.render({ container: eraserGraphics, target: rt, clear: false });`.

d. Clear the `eraserGraphics` object: `eraserGraphics.clear();`.

8. Observe the `Sprite` displaying the `RenderTexture`.

**Actual Behavior:**

The shape defined in step 7b is drawn onto the `RenderTexture` using normal blending, appearing as opaque white (or red, if used for testing) lines/pixels. The underlying content of the `RenderTexture` (or the background behind the sprite if the texture was initially clear) is simply painted over, not erased.

### Expected Behavior

**Expected Behavior:**

The shape defined in step 7b should create transparent areas (alpha = 0) in the `RenderTexture` where the opaque parts of the eraser shape were rendered, effectively erasing existing content or leaving initially transparent areas unchanged.

In my code example I have a backgroundLayer Ellipse that is being written over, where there should be no change to the visual canvas by using the Eraser tool

### Steps to Reproduce

code in react:

```

import { useEffect, useRef, useState, useCallback } from "react";

import "pixi.js/advanced-blend-modes"; // Ensure this runs early

import * as PIXI from "pixi.js";

import { countDrawingPixels, hexToNumber } from "../utils/canvasUtils";

import type { RenderTexture, Sprite, Graphics, PointData } from "pixi.js";

// Time window in milliseconds for throttling pixel counting

const PIXEL_COUNT_THROTTLE_MS = 250;

const MAX_ZOOM = 64;

const MIN_ZOOM = 1;

const PIXEL_DRAW_ZOOM_THRESHOLD = 8;

type PixiCanvasProps = {

color: string;

lineWidth: number;

tool: "draw" | "erase";

};

export function PixiCanvas({ color, lineWidth, tool }: PixiCanvasProps) {

const canvasRef = useRef<HTMLDivElement>(null);

const appRef = useRef<PIXI.Application | null>(null);

const renderTextureRef = useRef<RenderTexture | null>(null);

const drawingSpriteRef = useRef<Sprite | null>(null);

const isDrawingRef = useRef(false);

const penGraphicsRef = useRef<Graphics | null>(null);

const eraserGraphicsRef = useRef<Graphics | null>(null);

const parentContainerRef = useRef<PIXI.Container | null>(null);

const backgroundLayerRef = useRef<PIXI.Container | null>(null);

const pixelCountIntervalRef = useRef<number | null>(null);

const lastDrawnPixelPos = useRef<{ x: number; y: number } | null>(null); // For pixel drawing optimization

const lastLinePosRef = useRef<PointData | null>(null); // Ref to track the last point for line drawing

const [strokePixelCount, setStrokePixelCount] = useState(0);

const [zoomLevel, setZoomLevel] = useState(1); // Add zoom level state

// Refs to hold current prop values, avoiding effect dependency

const colorRef = useRef(color);

const lineWidthRef = useRef(lineWidth);

const toolRef = useRef(tool);

// Update refs whenever props change

useEffect(() => {

colorRef.current = color;

lineWidthRef.current = lineWidth;

toolRef.current = tool;

}, [color, lineWidth, tool]);

// handleCountPixels

const handleCountPixels = useCallback(async () => {

if (!appRef.current || !drawingSpriteRef.current) return;

const count = await countDrawingPixels(

appRef.current,

drawingSpriteRef.current

);

setStrokePixelCount(count);

console.log("Stroke pixel count:", count);

}, []); // Empty dependency array as it relies on refs

// Define stopPixelCountInterval *before* startPixelCountInterval

const stopPixelCountInterval = useCallback(() => {

if (pixelCountIntervalRef.current !== null) {

window.clearInterval(pixelCountIntervalRef.current);

pixelCountIntervalRef.current = null;

}

}, []);

// startPixelCountInterval (now correctly uses defined stopPixelCountInterval)

const startPixelCountInterval = useCallback(() => {

stopPixelCountInterval();

handleCountPixels(); // Call the memoized version

pixelCountIntervalRef.current = window.setInterval(() => {

handleCountPixels(); // Call the memoized version

}, PIXEL_COUNT_THROTTLE_MS);

}, [handleCountPixels, stopPixelCountInterval]); // Dependencies are other memoized functions

// applyZoom

const applyZoom = useCallback((newZoomFactor: number) => {

if (!appRef.current || !parentContainerRef.current) return;

const app = appRef.current;

const parentContainer = parentContainerRef.current;

const currentZoom = parentContainer.scale.x;

const newZoom = Math.max(

MIN_ZOOM,

Math.min(MAX_ZOOM, currentZoom * newZoomFactor)

);

if (newZoom === currentZoom) return;

const screenCenter = new PIXI.Point(

app.screen.width / 2,

app.screen.height / 2

);

const centerPointInContainer = parentContainer.toLocal(screenCenter);

parentContainer.scale.set(newZoom);

setZoomLevel(newZoom);

const newScreenCenterOfOldPoint = parentContainer.toGlobal(

centerPointInContainer

);

parentContainer.x -= newScreenCenterOfOldPoint.x - screenCenter.x;

parentContainer.y -= newScreenCenterOfOldPoint.y - screenCenter.y;

}, []);

// Zoom button handlers

const handleZoomInButton = useCallback(() => {

applyZoom(2);

}, [applyZoom]);

const handleZoomOutButton = useCallback(() => {

applyZoom(0.5);

}, [applyZoom]);

// --- Main PIXI Setup Effect (Mount only) ---

useEffect(() => {

if (!canvasRef.current) return;

const canvasElement = canvasRef.current;

let app: PIXI.Application;

let cleanupListeners: (() => void) | undefined;

const initPixi = async () => {

app = new PIXI.Application();

await app.init({

width: 720,

height: 720,

backgroundColor: 0xffffff,

antialias: true,

resolution: 1,

});

appRef.current = app;

canvasElement.appendChild(app.canvas);

app.canvas.style.width = "720px";

app.canvas.style.height = "720px";

const parentContainer = new PIXI.Container();

parentContainer.position.set(app.screen.width / 2, app.screen.height / 2);

parentContainerRef.current = parentContainer;

app.stage.addChild(parentContainer);

const backgroundLayer = new PIXI.Container();

backgroundLayerRef.current = backgroundLayer;

parentContainer.addChild(backgroundLayer);

const ellipse = new PIXI.Graphics()

.ellipse(0, 0, 250, 200)

.fill(0xeeeeee);

backgroundLayer.addChild(ellipse);

// Create the RenderTexture to draw onto

const rt = PIXI.RenderTexture.create({

width: app.screen.width,

height: app.screen.height,

});

renderTextureRef.current = rt;

// --- START ADDED CODE ---

// Ensure the render texture starts completely transparent black

// We do this by rendering an empty Graphics object to it with clear=true

const tempClearGraphics = new PIXI.Graphics();

app.renderer.render({

container: tempClearGraphics,

target: rt,

clear: true, // Clear the texture to its default (transparent black)

});

// --- END ADDED CODE ---

// Create a sprite to display the render texture

const drawingSprite = PIXI.Sprite.from(rt);

drawingSpriteRef.current = drawingSprite;

// Position sprite so that its texture aligns with parent container center

drawingSprite.position.set(-app.screen.width / 2, -app.screen.height / 2);

parentContainer.addChild(drawingSprite);

// Create Graphics objects for pen and eraser brushes

penGraphicsRef.current = new PIXI.Graphics();

penGraphicsRef.current.blendMode = "normal"; // Set normal blend mode for drawing

eraserGraphicsRef.current = new PIXI.Graphics();

eraserGraphicsRef.current.blendMode = "erase"; // Set eraser blend mode

const stage = app.stage;

stage.eventMode = "static";

stage.hitArea = app.screen;

// --- Event Handlers --- (Use memoized callbacks where appropriate)

const onPointerDown = (e: PIXI.FederatedPointerEvent) => {

if (

!penGraphicsRef.current ||

!eraserGraphicsRef.current ||

!renderTextureRef.current ||

!appRef.current ||

!parentContainerRef.current

)

return;

isDrawingRef.current = true;

lastLinePosRef.current = null; // Reset last line position

lastDrawnPixelPos.current = null;

const currentZoom = parentContainerRef.current.scale.x;

// Convert global pointer position to the local coordinates of the drawing sprite (which matches render texture coords)

const sprite = drawingSpriteRef.current;

if (!sprite) return;

const localPos = sprite.toLocal(e.global);

if (!localPos) return;

const currentToolGraphics =

toolRef.current === "erase"

? eraserGraphicsRef.current

: penGraphicsRef.current;

if (currentZoom < PIXEL_DRAW_ZOOM_THRESHOLD) {

// Low zoom: Prepare for line drawing by setting the start point

// We don't draw anything yet, just store the position

lastLinePosRef.current = { x: localPos.x, y: localPos.y };

} else {

// High zoom: Draw a single pixel immediately

const targetX = Math.floor(localPos.x);

const targetY = Math.floor(localPos.y);

const color =

toolRef.current === "erase"

? 0xffffff

: hexToNumber(colorRef.current);

const alpha = 1; // Always draw opaque for blend modes to work

currentToolGraphics

.rect(targetX, targetY, 1, 1) // Draw pixel at localPos

.fill({ color, alpha }); // Fill it

// Render the single pixel brush stroke to the texture

appRef.current.renderer.render({

container: currentToolGraphics,

target: renderTextureRef.current,

clear: false,

});

currentToolGraphics.clear(); // Clear the brush

lastDrawnPixelPos.current = { x: targetX, y: targetY };

}

startPixelCountInterval(); // Use memoized version

};

const onPointerMove = (e: PIXI.FederatedPointerEvent) => {

if (

!isDrawingRef.current ||

!penGraphicsRef.current ||

!eraserGraphicsRef.current ||

!renderTextureRef.current ||

!appRef.current ||

!parentContainerRef.current ||

!drawingSpriteRef.current

)

return;

const currentZoom = parentContainerRef.current.scale.x;

// Convert global pointer position to the local coordinates of the drawing sprite (which matches render texture coords)

const sprite = drawingSpriteRef.current;

if (!sprite) return;

const localPos = sprite.toLocal(e.global);

if (!localPos) return;

const currentToolGraphics =

toolRef.current === "erase"

? eraserGraphicsRef.current

: penGraphicsRef.current;

// Re-assert Eraser Blend Mode

if (toolRef.current === "erase" && currentToolGraphics) {

currentToolGraphics.blendMode = "erase";

}

if (currentZoom < PIXEL_DRAW_ZOOM_THRESHOLD) {

// Low zoom: Draw line segment

let color =

toolRef.current === "erase"

? 0xffffff // Placeholder, will be overridden

: hexToNumber(colorRef.current);

const alpha = 1;

// --- TEST: Force eraser color to red ---

if (toolRef.current === "erase") {

color = 0xff0000; // RED for eraser strokes

}

// --- End Test ---

const prevPos = lastLinePosRef.current;

if (!prevPos) {

lastLinePosRef.current = { x: localPos.x, y: localPos.y };

return;

}

currentToolGraphics

.moveTo(prevPos.x, prevPos.y)

.lineTo(localPos.x, localPos.y)

.stroke({

width: lineWidthRef.current,

color: color, // Will be red if eraser

alpha: alpha,

cap: "round",

join: "round",

});

// Render the line segment brush stroke to the texture

appRef.current.renderer.render({

container: currentToolGraphics,

target: renderTextureRef.current,

clear: false,

});

// Clear the temporary graphics for the next segment

currentToolGraphics.clear();

// Update the last position for the next move event

lastLinePosRef.current = { x: localPos.x, y: localPos.y };

} else {

// High zoom: Draw individual pixels

const targetX = Math.floor(localPos.x);

const targetY = Math.floor(localPos.y);

if (

!lastDrawnPixelPos.current ||

lastDrawnPixelPos.current.x !== targetX ||

lastDrawnPixelPos.current.y !== targetY

) {

let color =

toolRef.current === "erase"

? 0xffffff // Placeholder, will be overridden

: hexToNumber(colorRef.current);

const alpha = 1;

// --- TEST: Force eraser color to red ---

if (toolRef.current === "erase") {

color = 0xff0000; // RED for eraser pixels

}

// --- End Test ---

currentToolGraphics

.rect(targetX, targetY, 1, 1)

.fill({ color: color, alpha }); // Will be red if eraser

// Render the single pixel brush stroke to the texture

appRef.current.renderer.render({

container: currentToolGraphics,

target: renderTextureRef.current,

clear: false,

});

currentToolGraphics.clear(); // Clear the brush

lastDrawnPixelPos.current = { x: targetX, y: targetY };

}

}

};

const onPointerUp = () => {

if (isDrawingRef.current) {

isDrawingRef.current = false;

lastLinePosRef.current = null; // Reset line position tracking

stopPixelCountInterval(); // Use memoized version

// Clear the temporary graphics objects now the stroke is finished

penGraphicsRef.current?.clear();

eraserGraphicsRef.current?.clear();

// Ensure a final pixel count check

handleCountPixels(); // Use memoized version

}

};

const onWheel = (e: WheelEvent) => {

e.preventDefault();

if (!appRef.current || !parentContainerRef.current) return;

const parentContainer = parentContainerRef.current;

const currentZoom = parentContainer.scale.x;

const pointerGlobalPos = new PIXI.Point(e.clientX, e.clientY);

if (!e.ctrlKey && (Math.abs(e.deltaX) > 0 || Math.abs(e.deltaY) > 0)) {

parentContainer.x += -e.deltaX / currentZoom;

parentContainer.y += -e.deltaY / currentZoom;

return;

}

const newZoom = Math.max(

MIN_ZOOM,

Math.min(MAX_ZOOM, currentZoom * (e.deltaY < 0 ? 1.1 : 1 / 1.1))

);

if (newZoom === currentZoom) return;

const pointerPos = app.stage.toLocal(pointerGlobalPos);

const containerPointerPos = parentContainer.toLocal(pointerPos);

parentContainer.scale.set(newZoom);

setZoomLevel(newZoom);

const newContainerPointerPos = new PIXI.Point(

containerPointerPos.x * newZoom,

containerPointerPos.y * newZoom

);

const newPointerPos = parentContainer.toGlobal(newContainerPointerPos);

parentContainer.x -= newPointerPos.x - pointerPos.x;

parentContainer.y -= newPointerPos.y - pointerPos.y;

};

// Add event listeners

stage.addEventListener("pointerdown", onPointerDown);

stage.addEventListener("pointermove", onPointerMove);

stage.addEventListener("pointerup", onPointerUp);

stage.addEventListener("pointerupoutside", onPointerUp);

canvasElement.addEventListener("wheel", onWheel, { passive: false });

cleanupListeners = () => {

stage.removeEventListener("pointerdown", onPointerDown);

stage.removeEventListener("pointermove", onPointerMove);

stage.removeEventListener("pointerup", onPointerUp);

stage.removeEventListener("pointerupoutside", onPointerUp);

canvasElement.removeEventListener("wheel", onWheel);

};

};

initPixi().catch(console.error);

// Cleanup function for the effect

return () => {

stopPixelCountInterval(); // Use memoized version

cleanupListeners?.();

if (appRef.current) {

appRef.current.destroy(true, { children: true, texture: true });

appRef.current = null;

}

};

}, []); // Empty dependency array: Runs only on mount/unmount

// --- Return JSX ---

return (

<div className="flex flex-col items-center">

{/* Canvas and Buttons Container */}

<div className="relative" style={{ width: "720px", height: "720px" }}>

<div

ref={canvasRef}

className="absolute top-0 left-0 border border-gray-200 rounded-lg overflow-hidden"

style={{ width: "100%", height: "100%", touchAction: "none" }}

/>

<div className="absolute top-2 right-2 z-10 flex flex-col space-y-1">

<button

onClick={handleZoomInButton}

className="w-8 h-8 flex items-center justify-center bg-gray-700 text-white rounded text-lg hover:bg-gray-600 transition-colors disabled:opacity-50"

title="Zoom In (2x)"

disabled={zoomLevel >= MAX_ZOOM}

>

+

</button>

<button

onClick={handleZoomOutButton}

className="w-8 h-8 flex items-center justify-center bg-gray-700 text-white rounded text-lg hover:bg-gray-600 transition-colors disabled:opacity-50"

title="Zoom Out (2x)"

disabled={zoomLevel <= MIN_ZOOM}

>

-

</button>

</div>

</div>

{/* Controls Below Canvas */}

<div className="mt-4 space-y-2 w-\[720px\]">

<div className="mt-2 p-3 bg-gray-100 rounded-lg text-sm font-mono text-center">

Zoom: {zoomLevel.toFixed(2)}x (Pixels &ge; {PIXEL_DRAW_ZOOM_THRESHOLD}

x)

</div>

<div className="mt-2 p-3 bg-gray-100 rounded-lg text-sm font-mono text-center">

Stroke Pixel Count: {strokePixelCount}

<div className="text-xs text-gray-500 mt-1">

Update frequency: every {PIXEL_COUNT_THROTTLE_MS}ms

</div>

</div>

</div>

</div>

);

}

```


r/pixijs • • Dec 05 '24

Join my Game Project! No? Ok πŸ˜”

Thumbnail reddit.com
2 Upvotes

r/pixijs • • Jun 15 '26

I got tired of fighting my tooling, so I built my own PixiJS DevTools extension

2 Upvotes

Over the last few years I've been working professionally with PixiJS, building games on a daily basis.

One thing that kept slowing me down was debugging complex scene hierarchies.

I found myself repeatedly fighting with my tooling instead of inspecting the game. Sometimes the inspector would become unresponsive until I refreshed both the page and Chrome DevTools. Other times, selecting an object deep in the scene tree would cause the tree to jump back up, making it frustrating to navigate large nested hierarchies.

After running into these issues enough times, I decided that I've hade enough and started building my own DevTools extension for PixiJS.

My main goal wasn't to reinvent existing tools, but to create something that feels faster, more reliable, and more practical for everyday development, and most importantly - something that I would enjoy using.Β 

Some of the features I've added so far are things that I need to use on a daily basis like:

β€’ Scene graph inspection and property editing
β€’ Object highlighting and selection
β€’ Move Mode β€” select a sprite or container and reposition it directly with the mouse
β€’ Image Overlay β€” place a Figma export or design reference on top of the running game to compare layouts pixel-perfectly

It's still early, but I've already started using it in real projects and it's been a huge improvement to my own workflow.

I'm curious:

What are the biggest frustrations you've encountered when debugging PixiJS applications?

And if you're using PixiJS professionally, what features would you want from a DevTools extension?


r/pixijs • • Feb 28 '26

Pixel Pilot: Pixel art and animation made easy on MacOS

4 Upvotes

Hi Guys,

This might be useful for any aspiring game dev who work on MacOS, it's a fully fledged sprite editor with animation tools, exports to a variety of formats.

If it gets any uptake, I will improve it further over time and continue my work on bringing it to iOS.

Hope you enjoy:

https://apps.apple.com/gb/app/pixel-pilot/id6755254159?mt=12

Pixel Pilot


r/pixijs • • Dec 27 '24

[BETA] Glixy - Performant PixiJS apps in Svelte without a struggle ✨

4 Upvotes

Heya Svelte fellas!

PixiJS is a very popular library for building 2d interfaces in WebGL. Working with it directly is painful, yet tool is *very* powerful. Despite there are solutions like `svelte-pixi`, they are out of date and they act more like a proxy between Svelte and PixiJS, rather than having delegated actual responsibilities. From now on, Svelte developers can build 2d WebGL interfaces with PixiJS without a struggle in the most performant manner!

What achieves:

- Avoid memory leaks

- Render on demand

- Illegally fast

- Declarative API and Component Architecture

- Claims to not be a leaky PixiJS abstraction

Live Demo (playful), Source & Docs -> glixy.dev

Don't waste a chance to use my warm invitation for sharing any feedback or contributing improvements πŸ”₯


r/pixijs • • Jun 04 '26

Good examples of UI

4 Upvotes

Anyone have done good examples of ui made in pixi? Tired of my game looking like a website lol


r/pixijs • • Jul 16 '26

Play MUGEN in your browser: I made a web version using ReactJS + PixiJS

5 Upvotes