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

Changing a value over time, based on previous frame

Community Beginner ,
Dec 22, 2014 Dec 22, 2014

Copy link to clipboard

Copied

I have a layer that I need to move based on a number that gets calculated each frame. That number is added or removed from the position, but if you do something like this:


[value[0]+10, value[1]]


... you end up with 10 added to the original position, not the position that resulted from previous expressions. Is there a simple way to retain the calculated position? I've always worked using time to get a procedurally generated position, but that's not going to work in this case.

TOPICS
Expressions

Views

1.9K

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
Community Expert ,
Dec 22, 2014 Dec 22, 2014

Copy link to clipboard

Copied

Expressions have no way to access their own calculated values from previous frames. If you can't base it on time (although your example could be done with something like this):

value + [10*timeToFrames(time),0]

you can have the expression loop through time frame-by-frame to recreate previous results to be used in the current frame's calculation. Not particularly efficient, but it does work.

Dan

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
Community Beginner ,
Dec 22, 2014 Dec 22, 2014

Copy link to clipboard

Copied

Yeah, that's what I was worried about. Essentially what I was trying to do was drive a Particular position in a new random direction every x frames, but I'm not sure how I'd do it procedurally if I can't keep track of an evolving position. AE really needs persistent global variables, though I understand that's way easier said than done.

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
Community Expert ,
Dec 22, 2014 Dec 22, 2014

Copy link to clipboard

Copied

It's not too bad if x is a constant number of frames. You can loop through all the previous x-frame segments, and calculate the ending position for that segment (based on the starting position for the previous segment), which will give you starting position for the current segment.

Dan

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
Community Expert ,
Dec 27, 2014 Dec 27, 2014

Copy link to clipboard

Copied

LATEST

I can't write it in my head, and I'm replying from a smart phone, but you can do this with value at the time expressions. If I get a chance later today I will write one up.

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