Previous topicNext topic

Reset Value

Questions, comments, feedback, etc.
Post Reply
VidEZ
Posts: 16
Joined: Sat Jan 16, 2021 8:03 pm

Reset Value

Post by VidEZ »

Hi,
I have an InputSelector module which chooses 1 of 4 images to display. For this module, I use an Increase function, and the Wrap function to rotate the Input# through 1 to 4 to change the images. Pretty simple.

I have a scaling module then. I want to increase the x and y scale value of the images over time. By itself that's easy to do. However I want to RESET the scale back to 1, every time the image changes. The reset has to happen or be synced to Input# of the InputSelector module.

Here's the tricky part - I want the scale or scaling values for x and y to increase much faster than the Increase function used to change or rotate the images. So I can't have one global Increase function for both.

So while the Increase function in the InputSelector module is moving from 0 to 6
when the value is 0 to 1 in the InputSelector module, then I want the scale values in Scale module to run from 0 to 300 (it's moving faster)
then once Input # changes - I want to reset the scale value back to 0 in the Scale module

So....the reset of the scaling needs to be synced to values in the InputSelector module, or to a global variable.

I thought if I could pass a variable into the Wrap() [aka mod] function, then I could reset the modifier value that way. But I can't.
I tried some expressions like if(x%2=0, 0, x) but these don't genuinely RESET the modifier value, they assign it a value (here zero) once the expression is true and then it's back to input value when it's not true.

Any ideas would be appreciated. I hope I explained it well.

Thanks
Vmusic
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Reset Value

Post by Magic »

You’re making it way too complicated for yourself. You can indeed have one global Increase. Just put a Scale modifier after it in the place you need it to increase faster.
VidEZ
Posts: 16
Joined: Sat Jan 16, 2021 8:03 pm

Re: Reset Value

Post by VidEZ »

I appreciate you looking at this, but your approach doesn't work. I actually tried that. I may have not have explained it well.

So the global Increase variable that changes the InputSelector runs, and has a Wrap of 6. So it will increase until it gets to 6 and then start back at zero.
At the change of every integer, the Input# changes and the images changes.
Again.....it's NOT until the Increase value reaches the Wrap value (6) that it resets to 0.

What has to happen is for the Scale module to reset to zero at the change of every integer of the global Increase variable.
In other words, when the image changes, the scale gets reset to zero.

If I use a single global Increase variable, the Scale module value won't reset to zero until the global Increase variable resets. I want it to reset at every integer change, which is the change of the Input# in the InputSelector module.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Reset Value

Post by Magic »

Then do Wrap 1 in your Scale module.
VidEZ
Posts: 16
Joined: Sat Jan 16, 2021 8:03 pm

Re: Reset Value

Post by VidEZ »

I figured it out!


First global variable called changeInput
Increase 0.14
Wrap 6
this setting change the InputSelector module, specifically the Input# at a rate that suits my video

Second global variable called setScale
It takes the value of the first global input variable changeInput
Expression x-floor(x)

What happens - the value of setScale goes from 0 to 1 at the same "rate" as an integer change in the first global variable
So when the first global variable changeInput goes from 0 to 1, or 1 to 2, or 2 to 3, or 3 to 4, etc, the setScale variable gets reset to 0.

What the floor(x) takes the integer part, of a number so 4.2342 becomes 4, and 0.9823 becomes 0.

Hope This Helps Someone Else
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Reset Value

Post by Magic »

x-floor(x) is what Wrap 1 does more efficiently.
VidEZ
Posts: 16
Joined: Sat Jan 16, 2021 8:03 pm

Re: Reset Value

Post by VidEZ »

Ahhh...... OK; thank you.
Post Reply