Git Product home page Git Product logo

pixi-react's Introduction

pixi-react

Pixi React

Simply the best way to write PIXI applications in React
Write PIXI applications using React declarative style ๐Ÿ‘Œ


release downloads ci tests license react version pixi version


Pixi React is an open-source, production-ready library to render high performant PIXI applications in React.

News!

We're delighted to announce Pixi React v7.0.0, the first major release since making it an official Pixi package!

While all the core components remain the same, there have been some significant changes under the hood:

  • Full React 18 support including a new createRoot API, matching the signature of React 18's ReactDOM/client
  • Full Pixi V7 support
  • New up-to-date docs site
  • Repository converted to a monorepo with separate @pixi/react and @pixi/animated packages
  • Internally all pixi.js library imports were replaced with @pixi/ scoped package versions, providing bundlesize improvements for users who use modular builds
  • Scoped imports allowed us to remove @pixi/react-legacy and @pixi/react-animated-legacy packages, with rendering deferred to a user's installed pixi.js package
  • sideEffects: false added to package.json to support tree-shaking

We're excited to see what the community builds with the library and as ever please let us know on GitHub if you run into any issues, or reach out to us on the Discord to chat.

Thanks! PixiJS Team

Get started

Quick start

If you want to start a new React project from scratch, we recommend Create React App. To add to an existing React application, just install the dependencies:

Start New React Project "my-app" with Create React App:

# for typescript add "--template typescript"
npx create-react-app my-app
cd my-app

Install Pixi React Dependencies:

npm install pixi.js @pixi/react

Usage:

import { BlurFilter } from 'pixi.js';
import { Stage, Container, Sprite, Text } from '@pixi/react';
import { useMemo } from 'react';

export const MyComponent = () =>
{
  const blurFilter = useMemo(() => new BlurFilter(4), []);

  return (
    <Stage>
      <Sprite
        image="https://pixijs.io/pixi-react/img/bunny.png"
        x={400}
        y={270}
        anchor={{ x: 0.5, y: 0.5 }}
      />

      <Container x={400} y={330}>
        <Text text="Hello World" anchor={{ x: 0.5, y: 0.5 }} filters={[blurFilter]} />
      </Container>
    </Stage>
  );
};

Docs

Check out our documentation for guides and a full API reference.

Or checkout our examples on codepen for inspiration.

Contribute

Want to contribute to Pixi React? Our contributing guide has you covered.

License

Pixi React is MIT licensed.

This project was originally created and maintained by @inlet. He graciously gave the Pixi team the keys to maintain and push the project forward. Big thanks for all the hard work on making this project so awesome.

This projects codebase was originally forked from @michalochman 's react-pixi-fiber.

Meet fellow developers

You have an amazing feature in mind or just want to get in touch with other developers? Feel free to join our Discord channel.

Join us on Discord

pixi-react's People

Contributors

inlet avatar baseten avatar elob avatar fabienjuif avatar xaviergonz avatar dependabot[bot] avatar ledzz avatar kiochan avatar zyie avatar spassvogel avatar mattjennings avatar sabigara avatar wtgtybhertgeghgtwtg avatar rodrigohamuy avatar ximing avatar vijayst avatar goodboydigital avatar cometkim avatar zenios avatar adsko avatar zmike avatar juwoni avatar mushus avatar lm-noshiro avatar effy-coding avatar baco16g avatar queq1890 avatar maximtwo avatar aku11i avatar lunarraid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.