ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to trigger animation by markers (in and out) ?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rustem Sardoriev
How to trigger animation by markers (in and out) ?
on Sep 20, 2017 at 3:32:05 pm
Last Edited By Rustem Sardoriev on Sep 21, 2017 at 3:30:47 am

Hello
I have a project with many pair (in and out) markers (imported subtitles probably) on a layer. How it is possible to run a lower third every time when time indicator hits in-marker and stop animation when indicator hits out-marker? There is a ready to use expression ? Thank you for your help.


Return to posts index

DeMarc Johnson
Re: How to trigger animation by markers (in and out) ?
on Dec 1, 2017 at 5:04:00 am

Yes, there is a way to do this. In the marker comment section add your the dialogue.

var numK = thisComp.marker.nearestKey(time)// Use thisComp if the markers are in composition, else pick whip the layer the markers reside
var markerNum = numK.index;
var isMarkerNum = time >= numK.time ? markerNum : markerNum - 1; //This is getting the marker index number
thisComp.marker.key(isMarkerNum).comment


For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw


Return to posts index

DeMarc Johnson
Re: How to trigger animation by markers (in and out) ?
on Dec 1, 2017 at 5:07:05 am

I've forgot, but of course you will keep the out marker comment empty to get rid of the subtitles.

For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw


Return to posts index


Rustem Sardoriev
Re: How to trigger animation by markers (in and out) ?
on Dec 1, 2017 at 12:01:00 pm

@DeMarc Johnson
Hello. Thank you for helping me. I'am a complete begginer in AE. Here is some quick video about my AE project. As for as the text dialogue. My project has a bunch of imported captions with thei stamps. I want to use a starting stamp of each marker pair to trigger a one unique lower third animation to all starting stamps on a particular layer. Please look at the video.
Even the dialogue is't important for me at the moment but the possibility to repeat one lower therd (on it's own layer) on every starting marker (own layer).
https://www.sendspace.com/file/bq7i5k
Thank you


Return to posts index

DeMarc Johnson
Re: How to trigger animation by markers (in and out) ?
on Dec 2, 2017 at 12:40:54 am

You can make an lower third for each caption by creating a rectangle shape layer. *****Make sure you pick whip the text layer with the caption for that txt variable in the code.

//In the shape layer go to content > rectangle path > size and put in...
var txt = thisComp.layer("printing"); //Change by pick whipping the text layer with the caption
var x = txt.sourceRectAtTime(time - txt.inPoint).width; //This will make the shape layer the same width as the text
var y = txt.sourceRectAtTime(time - txt.inPoint).height;
[x, y]

//In the shape layer go to content > rectangle path > position and put in...
content("Rectangle Path 1").size / 2;


For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw


Return to posts index

Rustem Sardoriev
Re: How to trigger animation by markers (in and out) ?
on Dec 2, 2017 at 1:55:20 pm

Hello
I tried my best for my zero level. Can you please correct me ?

AE project with entered (by me) expressions (I tried my best).
https://www.sendspace.com/file/8hqa3v
Video of what I am doing.
https://www.sendspace.com/file/g3fh1i

var txt = thisComp.layervar txt = thisComp.layer("TEXT+MARKERS");
var x = txt.sourceRectAtTime(time - txt.inPoint).width; //This will make the shape layer the same width as the text
var y = txt.sourceRectAtTime(time - txt.inPoint).height;
[x, y]var x = txt.sourceRectAtTime(time - txt.inPoint).width; //This will make the shape layer the same width as the text
var y = txt.sourceRectAtTime(time - txt.inPoint).height;
[x, y]

//In the shape layer go to content > rectangle path > position and put in...
content("Rectangle Path 1").size / 2;


Return to posts index


DeMarc Johnson
Re: How to trigger animation by markers (in and out) ?
on Dec 3, 2017 at 2:11:15 am

I was messing around with the file you give and one problem was that text layer was scaled. I don't know why, but scale makes the sourceRectAtTime go crazy.
Another problem was some of the code you had copied from the forum was repeated twice.
I added a null with a slider control to give you better control over the width and the height.
I added the code that I spoke about earlier in the forum, this way you don't have add keyframes, but just add/delete markers to change caption.
(Sorry, I'd forgot to tell you to put that first code in the sourceText property).
Don't delete the first marker.

11926_cowvideoismissingconverted.zip

For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw


Return to posts index

Rustem Sardoriev
Re: How to trigger animation by markers (in and out) ?
on Dec 3, 2017 at 9:20:39 am

I'm sorry for scailing. Here is a project clean with only two (ShAPE+TEXT&MARKERS) layers without scailing.
No expressions. Absoluntly clean as you would expect.
https://www.sendspace.com/file/lx4803
Can you please correct me one more time with text without scaling ? Please.

Unfortunatly I can't open (my version of AE is13) right now the project with scaled text. I do not have AE14 version on my computer right now. But this evening I will get a laptop with last version of AE, if it will be possible.

Thank you


Return to posts index

Rustem Sardoriev
Re: How to trigger animation by markers (in and out) ?
on Dec 4, 2017 at 5:09:06 pm

I'm sorry for scailing. Here is a project clean with only two (ShAPE+TEXT&MARKERS) layers without scailing.
No expressions. Absoluntly clean as you would expect.
https://www.sendspace.com/file/lx4803
Can you please correct me one more time with text without scaling ? Please.

Unfortunatly I can't open (my version of AE is13) right now the project with scaled text. I do not have AE14 version on my computer right now. But this evening I will get a laptop with last version of AE, if it will be possible.


UP
Please look up the video. This is absolutely not what I ment.
The red rectangle was created for the lower third and not for captions ☺
https://www.sendspace.com/file/ajriq7


Return to posts index


DeMarc Johnson
Re: How to trigger animation by markers (in and out) ?
on Dec 5, 2017 at 12:48:43 am

Sorry I was wrong, you can scale if you want to scale the text. It was the spacing between lines that was making sourceRectAtTime() at a little weird. I guess because you spaced more than I ever have was using sourceRectAtTime it caused a problem, but I did a workaround by parenting the shape layer to the text layer and by using a if/else in the position of the shape layer.
You can use the sourceRectAtTime for both caption and lower thirds. In this AE file add more padding on the x position to give it a lower third look.
I pretty sure there is a better way to code the sourceRectAtTime problem, but this work great for a quick fix.
11930_cowvideoismissingconverted.zip

//Here is that position code other people who are reading this.
var txt = thisComp.layer("TEXT+MARKERS");
var twoLine = txt.sourceRectAtTime(time - txt.inPoint).height;
var slider = thisComp.layer("Padding Control").effect("twoLine")("Slider"); //A slider control to control the Y position when there is two lines
var x = value[0];
var y = twoLine > 60 ? value[1] + slider : value[1]; //Here is the if/else statement that allow me move the y position accordingly for the second line
[x, y]


For Expression Tutorials:
https://www.youtube.com/channel/UCe77szX2n1WSKsGs-2gmbDw


Return to posts index

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