Notifications
Clear all

[Closed] Slider for keyframes

Hi
noob alert

ok here the thing…

we have a few objects let’s say 3 boxes

each box is animated and has 2 keyframes . one key at frame zero with a default value of positian/rotaion/scale and the other is at frame -5 with a new value of positian/rotaion/scale.

I wrote this code:

rollout unnamedRollout “Untitled”
(
button btn1 “Button”
on btn1 pressed do
(
with animate on
for obj in selection do
obj.transform = at time -5 obj.transform
)
)
createdialog unnamedRollout

executing this code gives us a rollout with on button.

now if I select thoes 3 boxes and push the button at frame 20 for example, thoes boxes get keyframes created at frame 20 with the value at frame -5.

so far everything is working just fine but it is all kinda a boolean operation. there is just a button and by pushing it I get desired value from frame -5 and I can have it on any frame I like.

Now here is my question: how can I use a “slider” instead of a button to get a percent of values from frame -5

sorry for my bad English by the way

2 Replies

Look up linear interpolation ( lerp ) for position values and spherical linear interpolation for rotation values ( slerp ). And use them to blend between the two transform values.

tnx I’ll look into it