Markus Posted August 2, 2013 Share Posted August 2, 2013 I think it can be done with the drawCircle Method.. ?? http://jsfiddle.net/Maj0rrush/kdhEE/2/ Quote Link to comment Share on other sites More sharing options...
Kuboid Posted August 3, 2013 Share Posted August 3, 2013 I tried it out but I think I didnt find the most performant way http://kuboid.net/tests/particle/ If you want to have a look:http://kuboid.net/tests/particle/src.zip Edit: I think you sure can use drawCircle. In my solution I was lazy and just used PNGs but it shouldnt be a problem for you to replace it. Quote Link to comment Share on other sites More sharing options...
Markus Posted August 4, 2013 Author Share Posted August 4, 2013 Hey Kuboid, thx for your Approach. My Goal was it to use the DrawCircle Method. But i think pixi.js has no support for gradient Fill Style. //Time for some colors var gradient = ctx.createRadialGradient(p.x, p.y, 1, p.x, p.y, p.radius); gradient.addColorStop(0, "white"); gradient.addColorStop(0.1, "blue"); gradient.addColorStop(0.6, p.color); gradient.addColorStop(1, "black"); I looked in the PIXI.GRAPHICS.JS and there is only Support 4 Color Fill. Then i have to wait :-) and use a Sprite Graphic Approach. Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted August 5, 2013 Share Posted August 5, 2013 Sounds like a plan! to be honest it would be faster to use an image of a circle as piix.js is super optimised for images at the mo.But we definitely plan on extending the functionality of graphics to allow for gradients later down the line! Quote Link to comment Share on other sites More sharing options...
Ezelia Posted August 5, 2013 Share Posted August 5, 2013 @Markus : you can try my PIXI hack and draw what you want as usual with the classic canvas2D context, then cache the result : http://www.html5gamedevs.com/topic/518-hack-making-all-2d-drawing-functions-available-to-pixi/ Quote Link to comment Share on other sites More sharing options...
xerver Posted August 5, 2013 Share Posted August 5, 2013 @Markus : you can try my PIXI hack and draw what you want as usual with the classic canvas2D context, then cache the result : http://www.html5gamedevs.com/topic/518-hack-making-all-2d-drawing-functions-available-to-pixi/ Less of a "hack" and more of "using the API as designed". I've been using custom shape textures by drawing on canvas for a while now (well before PIXI.Graphics), that is why Texture.fromCanvas() is there Quote Link to comment Share on other sites More sharing options...
Markus Posted August 5, 2013 Author Share Posted August 5, 2013 Less of a "hack" and more of "using the API as designed". I've been using custom shape textures by drawing on canvas for a while now (well before PIXI.Graphics), that is why Texture.fromCanvas() is there Hmm .. Can you give me an Example how i use the Texture.fromCanvas Method ? Quote Link to comment Share on other sites More sharing options...
xerver Posted August 5, 2013 Share Posted August 5, 2013 Draw on a canvas, then use Texture.fromCanvas() to create a texture out of it and apply it to a sprite, just as you would any other texture. Ezelia's link is a great example of using the fromCanvas method. Quote Link to comment Share on other sites More sharing options...
Markus Posted August 6, 2013 Author Share Posted August 6, 2013 Draw on a canvas, then use Texture.fromCanvas() to create a texture out of it and apply it to a sprite, just as you would any other texture. Ezelia's link is a great example of using the fromCanvas method. Oh yes :-) i didnt read it carefully :-). Update: I Tried this and i came to the decision to use Graphics :-). Thx 4 your time !I only have to figure out why the fps going down @ > 270 Graphic Objects. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.