Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

404
Views
Matter.js Crear rectángulo con propiedad de texto no funciona

Actualmente estoy tratando de hacer un rectángulo con texto dentro.

Aquí está mi código actual:

 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>

Aquí está el enlace a otra publicación de stackoverflow cuya respuesta usé en mi código: Matter.js Texto dentro de un rectángulo

Pero con la estructura alámbrica solo se crea un cuadrado sin nada en él. Con la estructura alámbrica desactivada, no muestra nada, pero está allí porque puedo ver su contorno si cambio el estilo de trazo del cuerpo.

También intenté encontrar información sobre la propiedad de texto de un Cuerpo en la documentación.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!