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

Time offset help

Engaged ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

Hello Lovely AE Peeps

Slowly, incrementally, I am starting to get a glimmer of how JS works in AE- and then I hit a wall.

I don't understand how time offsetting works, if it can be applied 'deeper' into a script ( at the end of whatever values have been calculated), or if it has to be inserted directly to the source element that is producing the values. But that probably makes no sense, as I don’t know how to even talk about the operations within JS!

What I'm working on is some dynamic text driven animations that can be driven by text numerical values, entered by editors within Adobe Premiere.

For example, here is a simple graph that I have not spiffed up in any way yet:

Dynamic Text Graph.png

The dark red txt in the bottom right are set as guide layers (and will be invisible on renders).They are the Max, and Min Values for the graph, extracted using "parseFloat".

The value I'm representing in a bar graph, I refer to as a "plot". Here is my JS that produced the above image:

All the yellow values on the left are generated on the min/max values entered, and rounded to no decimal places with ".toFixed(0)"

The below script is what drives the white bar graph pictured above:

——————

plotTXT= thisComp.layer("Value input 1").text.sourceText;

plot = parseFloat(plotTXT);

//converts source text into value, for the "plot"

minTXT=thisComp.layer("Min Graph input"). text.sourceText;

min=parseFloat(minTXT);

//converts source text into value, for the "min"

maxTXT=thisComp.layer("Max Graph input"). text.sourceText;

max=parseFloat(maxTXT);

//converts source text into value, for the "max"

net=max-min;

percent=(plot/net);

//does the math to solve what percent the plot is of the net values listed on the graph.

percentANIM=percent*thisComp.layer("Animation").transform.position[0];

//takes an exponential animation from a null object's position (from 0-100), producing a scale up animation, for a transition in.

offset = -.5;

T=time+offset;

offsetAnim=valueAtTime(T);

// this is my scratch pad WIP that is not functioning yet.

[100, percentANIM]

//applies the script to the Y axis of a scale on my bar graph shape layer

(which has an anchor point set at the position of 0 on the graph)

——————

The above script generated this output:

Dynamic TXT driven Graph_Animated.gif

I got as far as I did with time offsetting via this helpful post:

AE Scripting Tutorial: Time Offset Expression

—————

offset = -.5;
//The offset in time, negative half a second.

p = thisComp.layer(“My Animated Layer”);
//The parent layer

t = time + offset;
//The current time minus half a second

p.position.valueAtTime(t);
//Value of the parent’s position property at the current time minus half a second

——————

I’m not having any luck formatting this for my animation type (Position value, from 0-100 on a Null Layer).

Does anyone have any advice on how I could achieve a time offset of the animation from my null layer:

"thisComp.layer("Animation").transform.position[0]”;

so that I could stager the transition in animations of multiple elements, driven by one animation?

I’m hoping to have all the visual elements animate in to their full positions, and to add several more user-enterable bar graphs to the right of the one pictured.

Any help is appreciated

Best,

David

TOPICS
Scripting

Views

1.2K

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
Engaged ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

Ha- I think I figured it out actually, go figure:

offset = -1;

//The offset in time, negative half a second.

p = thisComp.layer("Animation");

//The parent layer

t = time + offset;

//The current time minus half a second

stagerANIM=p.position.valueAtTime(t);

//Value of the parent’s position property at the current time minus half a second

plotTXT= thisComp.layer("Value input 2").text.sourceText;

plot = parseFloat(plotTXT);

minTXT=thisComp.layer("Min Graph input"). text.sourceText;

min=parseFloat(minTXT);

maxTXT=thisComp.layer("Max Graph input"). text.sourceText;

max=parseFloat(maxTXT);

net=max-min;

percent=(plot/net);

percentANIM_Static=percent*thisComp.layer("Animation").transform.position[0];

TransIn=percent*stagerANIM[0];

[100, TransIn]

Maybe someone can explain to me why I need the [0] at the end of line 36? I clearly have no idea how JS works!

Ohh, and perhaps someone has a way of calculating the time offset based on the inpoint of a layer in the comp?

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 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

Your stagerAnim reference a position property , which is an Array of 3 values [x,y,z] that you can access with their index starting at 0.

So to get x, you do stagerAnim[0], y stagerAnim[1] .....

from Property object — After Effects Scripting Guide 0.0.1 documentation  :

var myProperty = myLayer.position;

// position has propertyValueType of ThreeD_SPATIAL, and is stored as an array of 3 floats

myProperty.setValue([10.0, 30.0, 0.0]);

// Variable my Position is an array of 3 floats

var myPosition = myProperty.value;

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
Engaged ,
Mar 20, 2018 Mar 20, 2018

Copy link to clipboard

Copied

LATEST

Hey thanks so much

Any ideas how to write a script that creates a time value that could be used for offetting, based on the in point of the layer?

D

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