Random values inside the axes of a variable font

  • Hello guys!
    I'm working with my typeface "Extra" to produce different animations with drawbot.
    Im fairly new to python and i'm trying to write a script that uses random values inside of the axes of a variable font.

    This typeface has 3 axes
    Weight (100-900)
    Width (100-900)
    Repetition (0-10)

    So, instead of saying that i want X values to be animated, how can i say to the program to chose random ones inside of these 3 axes, and animated randomly every time i export as a gif?

    Thank you very much, hope you can help me!
    Have a good day 🙂

    !Animating in Drawbot.gif

  • I am not quite sure what exactly you are asking but the get a random integer value inside a range you could use randint(min_value, max_value). This works for integers. To get a random value between 100 and 900 you would use randint(100, 900).
    If you have a smaller range and want fractions as well you could use min_value + random() * (max_value - min_value) eg 100 + (900-100) * random()
    I hope that helps, good luck!

Log in to reply