• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Changing x position of last keyframe using a slider for template

Explorer ,
Mar 04, 2024 Mar 04, 2024

Copy link to clipboard

Copied

I've searched for an expression that will use a slider to change the x position on the last keyframe but can only seem to get it work on adjusting the first keyframes x position instead. 

Any help as to what I need to amend in the expression to get it work would be great. 


Screenshot 2024-03-04 at 12.16.39.pngScreenshot 2024-03-04 at 12.17.00.pngScreenshot 2024-03-04 at 12.17.16.png

TOPICS
Error or problem , Expressions

Views

346

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 04, 2024 Mar 04, 2024
firstValue = key(1).value[0];
sliderValue = effect("Slider Control")(1);

   x = linear(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
// x = ease(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
// x = easeIn(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
// x = easeOut(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
[x, value[1]]

In your screenshot you're not using a linear interpolation so you may need to use an ease() instead of

...

Votes

Translate

Translate
LEGEND ,
Mar 04, 2024 Mar 04, 2024

Copy link to clipboard

Copied

Your code makes no sense. The driver in a linear() function is time or another slider's input, not the property base value itself. Simply fix the function and it will work.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 04, 2024 Mar 04, 2024

Copy link to clipboard

Copied

Hi Mylenium, 

If you could help me with what is correct that would be great. 

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 04, 2024 Mar 04, 2024

Copy link to clipboard

Copied

firstValue = key(1).value[0];
sliderValue = effect("Slider Control")(1);

   x = linear(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
// x = ease(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
// x = easeIn(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
// x = easeOut(time, key(1).time, key(numKeys).time, firstValue, sliderValue);
[x, value[1]]

In your screenshot you're not using a linear interpolation so you may need to use an ease() instead of linear()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

LATEST

That's amazing, thanks for that. Very helpful. How would I adjust the easing to say a specific in and out velocity. Or is that not possible? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines