ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Messaging Automation Question

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David O'Brien
Messaging Automation Question
on May 4, 2020 at 6:02:52 pm
Last Edited By David O'Brien on May 4, 2020 at 6:09:55 pm

Hi all - I'm trying to figure out how to automate text messaging animation flow. So, I have one long comp of the built out conversation made of 'message' comps inside of a 'convo' comp. What I'm trying to achieve is automation of the Y position moving up at every marker on the layer. My first attempt is trying to go into the convo comp, look at the first message comp's height and move the Y position equal to that number.

It's definitely not working, but it's showing signs of being on the right track. It moves on the first marker, but once it gets closer to the second marker - it resets back to zero and moves again at the second marker.

Apologies for the longwinded post here - just want to make sure I'm providing as much context as possible. I also want to say that I'm a long time listener, first-time caller. I've been visiting creative cow for over nearly 15 years or so and I can't tell you how many times this community and resource has helped me out.

A very warm thank you to everyone in advance.

m = marker;
n = 0;
moveTime = .2;
mNumber = m.numKeys;
innerMessageHeight = comp("Messages_Comp").layer(index+n).sourceRectAtTime().height+20;
moveAmt = innerMessageHeight;

if (m.numKeys > 0){
n = m.nearestKey(time).index;
t = time - m.key(n).time;
if (time < m.key(n).time) n--;
}
value + [n*-ease(t,0,moveTime,0,moveAmt)]



Return to posts index

Dan Ebberts
Re: Messaging Automation Question
on May 4, 2020 at 6:27:25 pm

For one thing, I think you need to switch the order of these two lines:

t = time - m.key(n).time;
if (time < m.key(n).time) n--;


Dan



Return to posts index

Dan Ebberts
Re: Messaging Automation Question
on May 4, 2020 at 6:42:45 pm

Actaully, I'd change the whole last part to this:


if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
if (n > 0){
t = time - m.key(n).time;
value + [-(n-1)*moveAmt-ease(t,0,moveTime,0,moveAmt)];
}else
value



Dan



Return to posts index


David O'Brien
Re: Messaging Automation Question
on May 4, 2020 at 6:56:48 pm

Thanks, Dan!

This is definitely working A LOT better. The issue now is that it's moving the height of index 1 every time, when I need it to move the height of the next index. So, the second marker should move it the height of index 2, the third marker index 3, etc.

Looking at my code, it makes sense that this will always produce the number 1:

layer(index+n)


But, I need to just sub in the number of the marker I'm currently at. Any thoughts?


Return to posts index

Dan Ebberts
Re: Messaging Automation Question
on May 4, 2020 at 7:03:42 pm

I guess you'd have to move the part that calculates moveAmt into the section after n is calculated, like this (not tested):


m = marker;
n = 0;
moveTime = .2;

if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
if (n > 0){
innerMessageHeight = comp("Messages_Comp").layer(index+n).sourceRectAtTime().height+20;
moveAmt = innerMessageHeight;
t = time - m.key(n).time;
value + [-(n-1)*moveAmt-ease(t,0,moveTime,0,moveAmt)];
}else
value



Dan



Return to posts index

David O'Brien
Re: Messaging Automation Question
on May 4, 2020 at 7:24:54 pm

I ended up achieving it by generating that index number through a slider on the layer, like this:


m = marker;
n = 0;
moveTime = .2;
mNumber = m.numKeys;
indexNumber = effect("index number")("Slider");
innerMessageHeight = comp("Messages_Comp").layer(index=indexNumber).sourceRectAtTime().height;
moveAmt = innerMessageHeight;

if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
}
if (n > 0){
t = time - m.key(n).time;
value + [-(n-1)*moveAmt-ease(t,0,moveTime,0,moveAmt)];
}else
value



And, it's working like I want it to, but for some reason, it's losing steam (so to say). Every movement after the first is just a little a little short. I can't quite figure out why.

Here's a quick render to show you what I mean:
https://www.dropbox.com/s/wez3nzb69jdrb7q/convo_comp_issue.mp4?dl=0

Any thoughts as to why that might be happening?

Also, again - thank you so much Dan! It's surreal to be getting your help on this and super appreciated.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]