This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Noah Levin
Posted Aug 07 - Read on Facebook

With Utils.mapRange, is there a way to make sure it doesn't overshoot the bounds? e.g. Utils.mapRange(dragY, 0, 200, 0, 1), when it gets past 200 the return value keeps going past 1... I guess I could wrap it in a min / max function, but surprised mapRange behaves in this way?


Koen Bok

Try my (beta) Utils.modulate:

Use like this:

out = Utils.modulate(in, [0,100], [1, 20], false)

Tisho Georgiev

Utils.modulate does the same thing and has a limit option:

Koen Bok


Tisho Georgiev

Damn you!

Tisho Georgiev

Well, Noah, you can maybe try Utils.modulate.

Noah Levin

Worked like a charm. Thanks, guys!

Florian Pnn

Koen Will you update the documentation with these 2 new functions for Utils ?

Read the entire post on Facebook