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
alternating .setFontSize() inside of an array

Im not really a programmer so please excuse the slightly crude description. This is an expression for a textlayer in Adobe After Effects (which uses Javascript)

I currently use this expression to generate an array of values (which is later used as customizable labels for the axes of a graph)

x = 0 //starting point (the first number in the list)
y= 20 //increments (the size of the steps)
z= 5 //the number of steps

Array.from(new Array(z)).map((_, i) => i * y + x + "km").join("\n")

which outputs

0km
20km
40km
60km
80km

Then I thought it would also be good to have miles in there so I changed the code to this

Array.from(new Array(z)).map((_, i) => i * y + x + "km " + (i * y + x) * 0.6 +"mi").join("\n")

I suppose its not beautiful but it does the job ...

0km 0mi
20km 12mi
40km 24mi
60km 36mi
80km 48mi

I then tried to add a customizable fontsize. Thats how I did it.

text.sourceText.style.setText
(
Array.from(new Array(z)).map((_, i) => i * y + x + "km " + (i * y + x) * 0.6 +"mi").join("\n")
)
.setFontSize(20)

This worked, but really I only want a different font size for the miles value and this is where I ran into trouble. I tried

Array.from(new Array(z)).map((_, i) => i * y + x + "km " + text.sourceText.style.setText((i * y + x) * 0.6 +"mi").setFontSize(10)).join("\n")

but this seems to break the code. It only outputs

0km [object Object]
20km [object Object]
40km [object Object]
60km [object Object]
80km [object Object]

any ideas? Thanks in advance

about 4 years ago · Juan Pablo Isaza
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