Jump to content

Pixi react with React


sayasajer
 Share

Recommended Posts

I'm not sure I'm following at all. React is a rendering library that implements a top-down functional architecture to help you build a rendering layer for your applications, Pixi does the same in that it helps you structure your rendering layer, but using canvas.

 

An event emitter can be implemented any way you like, both Pixi and React are agnostic to your implementation.

 

If you'd like to get properties from React components into Pixi, then just pass them through to whatever objects/classes/functions you are using to control Pixi. One thing to consider with React is that any DOM you create using JSX wont exist in the DOM until that component has mounted; usually this means that you let your component render, and then in the `ComponentDidMount` callback implement any code that needs that freshly created DOM (Pixi needs a DOM, specifically, a canvas).

 

There are a number of ways to trigger a screen refresh with React, are you after a way of telling Pixi to redraw whenever the React component mounting the canvas updates?

Link to comment
Share on other sites

There are a number of ways to trigger a screen refresh with React, are you after a way of telling Pixi to redraw whenever the React component mounting the canvas updates?

 

Yes, I am. For example there is a 'change background color' button which is in React Dom. When I click that button, the Pixi canvas color background will change according to that particular color.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...