Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
How do I create a matter.js compound out of svgs?

How can I create a body out of multiple svgs, so in the end I have one Svg with another one placed on top of it as part of the bigger svg?

By now I have two svgs here: https://codepen.io/m42444/pen/eYVEbOq I want the "H" to sit fixed on the big svg.

Thanks for any help!

const vertexSets = [],
firstColor = '#F9420B';
secondColor = '#009245';


  $('#svgOne').find('path').each(function(i, path){
    
    var svgOne = Bodies.fromVertices(percentX(80), percentY(30), Matter.Vertices.scale(Svg.pathToVertices(path, 10), (window.innerWidth / 2000), (window.innerWidth / 2000)), {
      render: {
        fillStyle: firstColor,
        strokeStyle: firstColor,
        lineWidth: 1
      }
    }, true);
    
  vertexSets.push(svgOne);
    console.log(vertexSets)

  });

  $('#svgTwo').find('path').each(function(i, path){
    
    var svgTwo = Bodies.fromVertices(percentX(80), percentY(30), Matter.Vertices.scale(Svg.pathToVertices(path, 10), (window.innerWidth / 2000), (window.innerWidth / 2000)), {
      render: {
        fillStyle: secondColor,
        strokeStyle: secondColor,
        lineWidth: 1
      }
    }, true);
    
  vertexSets.push(svgTwo);
    
  });
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda