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

What is Framer? Join the Community
Return to index
Josh Peters
Posted Jan 06 - Read on Facebook

So I've use a For loop to build out elements for a vertical bar graph. When they are created they are generated from the maxY point going upward, but when I create a function to change height randomly on an event, they grow in a downward direction.

How do i get them to alter the height going up instead?


Josh Peters

Ignore the "barHeight" variable. Doesn't affect anything

Josh Peters

An example of what happens after I click the button

Aalok Trivedi

I guess you could do something like this:

it keeps the maxY at the same position as it detects a change in height

Jonas Treub

When you set the originY to 1, you can use scaleY to change the height without affecting the maxY position.

Josh Peters

The best part about this is that I totally hacked it, by rotating its parent layer and fussing with the x, y. 😂

I'll try using the right method going forward.

Jangala Nikhileswar

Can we automate this? Like, here the bar heights change to a random number on click of the button. But can we do this height change, for 10 times, to random numbers, with just on click? Basically repeating an animation to random values?

Josh Peters

Here is the execution. Had to obfuscate some of this.

Read the entire post on Facebook