I am currently trying to make a rectangle with text inside.
Here is my current code:
var Engine = Matter.Engine,
Render = Matter.Render,
Runner = Matter.Runner,
Bodies = Matter.Bodies,
Body = Matter.Body,
Composite = Matter.Composite;
var engine = Engine.create();
var render = Render.create({
element: document.body,
engine: engine
});
var boxA = Bodies.rectangle(400, 305, 400, 400, {
render: {
fillStyle: "transparent",
strokeStyle: "transparent",
text: {
content: "Hello",
color: "black",
size: 15
}
}
});
var ground = Bodies.rectangle(400, 500, 810, 20, {
isStatic: true,
render: {
fillStyle: 'grey',
strokeStyle: 'transparent',
lineWidth: 3
}
});
Composite.add(engine.world, [boxA, ground]);
Render.run(render);
var runner = Runner.create();
Runner.run(runner, engine);
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.18.0/matter.min.js"></script>
Here is the link to another stackoverflow post which answer I used in my code: Matter.js Text inside a rectangle
But with wireframe on it just creates a square with nothing in it. With wireframe off, it doesn't display anything, but it is there because I can see the outline of it if I change the strokeStyle of the body.
I also tried finding information about the text property of a Body on the documentation.
Juan Pablo Isaza