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

151
Visualizações
how to convert complex graphing math into JavaScript

I have this Desmos graph: here

I was wondering if there was someone who could maybe provide some guidance for translating this into JavaScript. I understand most of the math, I just lack the knowledge on how to represent it in JS. My main goal is to calculate the position of rotating points on a JS canvas. I have already translated the canvas so that the coordinate system mirrors one of a mathematical graph.

ctx.translate(c.width/2, c.height/2);
ctx.scale(1, -1)

I would like to have 3 variables. The x and y of the player's current pos, the point of rotation x and y, and the target x and y.

Please let me know if I can provide more detail or any other info that could be of use.

-Thanks in advance.

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

0

you can do it with builtin api from canvas, example as below.

// x coordinate
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(150, 0);
ctx.stroke();

// y coordinate
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(0, 150);
ctx.stroke();

// point
ctx.beginPath();
ctx.arc(75, 75, 2, 0, Math.PI * 2, true)
ctx.fill();

see details in https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes

for complex graph, you can use d3.js library, see https://d3js.org/

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