-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement particles using Sprites #276
Comments
I took a look at this. It's going to be a significant chunk of work. And the implementation will be much more complicated -- the currently implementation ( |
Questions for @jonathanolson via Slack DM: I’m investigating re-implementing the particle systems in Beer’s Law Lab using Sprites (they are currently CanvasNode). Each particle is a square, with random rotation. What’s the best way to create an ImageableImage for use with SpriteImage? I’ve considered Here’s what I came up with. It seems to work if I add it to demoSprites.js. But in TypeScript, it involves a cast (from Node to Image) that feels unsafe. Is there a better way? const particleRectangle = new Rectangle( 0, 0, 50, 50, {
fill: 'red',
stroke: 'black'
} );
const particleCanvasElement = ( particleRectangle.rasterized( { wrap: false } ) as Image ).image;
const particleSpriteImage = new SpriteImage( particleCanvasElement, particleRectangle.center ); |
Node has |
As reported in #209, there is no longer any evidence of a performance issue with the current CanvasNode implementation. So I see no reason to convert to Sprites, and I'm closing this issue. |
To address the performance issues reported in #209, investigate using Sprites to draw shaker particles and precipitate particles. They are currently implemented as a subclass of CanvasNode. See base class ParticlesNode.ts.
ShakerParticlesNode.ts:
PrecipitateNode.ts:
The text was updated successfully, but these errors were encountered: