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

I want to assign a single keyframe x and y value to another effect like a slider, is it possible?

New Here ,
Feb 10, 2022 Feb 10, 2022

I basically want to assign a single keyframe x and y values to any other effect I want for a mogrt that I'm working on. I found this https://community.adobe.com/t5/after-effects-discussions/dynamic-keyframe-value-using-expression/td-... but all the codes there pop up with issues, does anybody know how to do this? or if there is a simpler way to do it.

 

this code that I tried pops up with this error

//reference to the property you've animated
prop = thisProperty
//reference to the first keyframe of the property you've animated
firstKey = prop.key(1).time;
//reference to the last keyframe of the property you've animated
lastKey = prop.key(prop.numKeys).time;
//the total distance traveled between your two keyframes
distanceTotal = prop.valueAtTime(lastKey) - prop.valueAtTime(firstKey);
//the distanced that's already been traveled on any given frame
distanceCurrent = prop.valueAtTime(lastKey) - prop.valueAtTime(time);
//the percentage of the total animation that's been completed on a given frame
percentage = 1 - distanceCurrent/distanceTotal;
//reference to a slider on a control layer that is used to modify the value of our
//final keyframe
offset = thisComp.layer("Expression Controls").effect("posición inicial barrita")("Slider");
//sets the value of the property to be it's current value plus a percentage of the value
//we set with our slider
value + offset*percentage;

Captura de pantalla 2022-02-10 110002.png

 

I just want to be able to change this specific keyframe that is highlighted in blue so that the starting position of the animation that has a mask can be later controlled in premiere with the mogrt that I'm creating, maybe there's an easier solution to what I'm trying to do.Captura de pantalla 2022-02-10 111144.pngCaptura de pantalla 2022-02-10 112005.png

TOPICS
Error or problem , Expressions , How to , Scripting
150
Translate
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
Community Expert ,
Feb 10, 2022 Feb 10, 2022
LATEST

Looks like your expression is designed to work on a 1D property, but position is 2D (x and y).

The easiest solution is probably to separate dimensions, such that you have a separate x and y position property. Then you can apply the expression to those instead.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
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