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

110
Visualizações
Ways to make bezier curves with about 8-9 control points in Javascript

I am making a game where i need to display ship traversing a flowing river. I am creating river with bezier curves but it is with only 3 control points from the bezerCurveTo. So, the river is not 'curvy enough.' How can i go about achieving this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The tabageos.GeometricMath Class has some advanced functions for curves, paths and merging Arrays. To accomplish what you want you could join multiple paths together. For example: https://codepen.io/Contrapenner/pen/mdBVrbw

function dot(x, y) {
    var d = document.createElement("span");
    d.setAttribute("style", "position:absolute;left:" + x + "px;top:" + y + "px;width:2px;height:2px;background: blue");
    document.getElementById("river").appendChild(d);
  };
  var riverPath = tabageos.GeometricMath.getRawArcCurvePath(5, 5, 10, 10, 5, 15, 10);
  riverPath = tabageos.GeometricMath.mergeArrays(riverPath, tabageos.GeometricMath.getRawArcCurvePath(5, 15, 0, 20, 5, 25, 10));
  riverPath = tabageos.GeometricMath.mergeArrays(riverPath, tabageos.GeometricMath.getRawArcCurvePath(5, 25, 10, 30, 5, 35, 10));
  riverPath = tabageos.GeometricMath.mergeArrays(riverPath, tabageos.GeometricMath.getRawArcCurvePath(5, 35, 0, 40, 5, 45, 10));
  //and you could keep going as needed.
  //there is also getRawHermiteCurvePath
  var i = 0;
  for (i; i < riverPath.length; i += 2) {
    dot(riverPath[i], riverPath[i + 1]);
  }
about 4 years ago · Juan Pablo Isaza Relatório
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