Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
How to make a variable increase or decrease exponentially in a for loop

I want to increase or decrease a variable in a exponential or speeding up manner in a piece of code that happens every frame.

This code gets executed every frame:

  if (animationLenght > 1) {
    animationLenght --
    // implement speeding up value 
    ...       
  }

Doesn't have to be exponential exactly but like that it accelerates (or decelerates)

The animation variable decreases linearly by one on every frame.

I want to increase or decrease a value in an non linear fashion, but like speeding up or slowing down smothly.

Any ideas?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can check the Math.exp() function: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math/exp

let expNum;
for(let i=0; i < length; i++){
   expNum = Math.exp(i)
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda