Comments (8)
Hi @lifecoderua!
Unfortunately pixi does not support primitives just yet. But it is on the todo list :)
Depending on your needs, ya could draw the circle in a canvas and the use the PIXI.Texture.fromCanvas( you_canvas_with_circle )
function to create a texture of the circle?
from pixijs.
Can you explain how this works? I'm referencing a canvas using jQuery:
var tex= PIXI.Texture.fromCanvas($('#myCanvas'));
But I get this error:
TypeError: argument 5 is not valid for any of the 6-argument overloads src/js/pixi.dev.js:1908
from pixijs.
$('#myCanvas')
isn't a DOMElement, it is a jQuery object.
Try:
var text = PIXI.Texture.fromCanvas($('#myCanvas')[0]);
or
var text = PIXI.Texture.fromCanvas(document.getElementById('myCanvas'));
from pixijs.
Yep, that worked. Thank you!
from pixijs.
Nice one fellas!
from pixijs.
Thank you, this helps! One more question: when I redraw a canvas and try to add a new texture from it - I have the same texture I draw the first time. This is probably because of BaseTexture cache. How to work around this in the best way? Create a new canvas each time I need to draw a figure?
from pixijs.
This probably has to do with the TextCache, caching a texture made from a canvas already.
from pixijs.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from pixijs.
Related Issues (20)
- Bug: Adding fill to certain Graphics with reversed normals causes lineStyle stroke to reverse inner/outer position
- Bug: 'Worker is not defined' with Pixi 7.4.0 and Node v18.17.1 HOT 15
- Bug: Incorrect Text color
- Bug: v8.0.0-rc.7 Calling Texture.update() causes texture rendering to fail HOT 2
- Bug: v8.0.0-rc.7 Exception when rendering odd-sided polygon after even-sided polygon
- Feature Request: Add Multi-Touch events HOT 4
- Bug: v8.0.0-rc.7 Canvas texture conflicts with Graphics when WebGL is used HOT 3
- Bug: v8.0.0-rc.7 iterating into a container and using removeChild causes object to to not be rendered
- Bug: v8.0.0.rc-8 Texture.update() does not update when source is resized HOT 3
- Bug: Empty sprite can break graphics rendering when using WebGPU + Chrome in 8.0.0-rc.9 HOT 2
- Assets.init failing HOT 4
- Bug: Uncaught TypeError: Cannot read properties of null (reading '_x') HOT 6
- Graphics not rendering HOT 4
- Feature Request: Video autoPlay for bundle asset loading HOT 1
- Pixi Text not showing the dynamic font loaded through Assets
- Bug: Unexpected Height during Initialization Pixi App HOT 1
- Bug: incorrect text stroke drawing with some fonts HOT 3
- Feature Request: Change the default priorities of the compressed textures formats HOT 1
- Bug: Asset format is not resolved correctly
- Feature Request: Make deprecation() warnings optional HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixijs.