Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all 47983 articles
Browse latest View live

Trying to automatically place and fill lower thirds triggered by comment markers

$
0
0

Hi,

 

 

I'm currently trying to solve a workflow idea based on the idea of script Guru Dan Ebberts of creating automatic subtitles from speech transcription markers (here is his script which works great for subtitling):

 

 

//****************************************************

// This expression creates a text string consisting

// of groups of five marker comment fields

// (separated by spaces). Each text string is displayed

// when the current time has reached the first marker

// of that group.

 

 

L = thisComp.layer("Legato_Ames_BTS_02_trans.mov");

max = 5; // number of words to display

 

 

n = 0;

if (L.marker.numKeys > 0){

  n = L.marker.nearestKey(time).index;

  if (L.marker.key(n).time > time){

    n--;

  }

}

 

 

 

 

s = " ";

if (n > 0){

  base = Math.floor((n-1)/max)*max + 1;

 

 

  for (i = base; i < base + max; i++){

    if (i <= L.marker.numKeys){

      s += L.marker.key(i).comment + "  ";

    }

  }

}

s

 

 

 

 

This script reads out the comment contents on the specific layer "Legato_Ames_BTS_02_trans.mov" (which have automatically been created via analyzing speech).

 

 

My idea was to modify the script that it reads not only the markes on the specific layer but in ALL layers within this composition.

 

 

Then I created a lower third animation (e.g. a new composition) which I also want to trigger its start everytime where a marker is placed on one of the layers within the composition so that when the playbar hits a marker, the script reads out the comment content (which already works by the script above) and also starts the background lower third animation comp.

 

 

If this is not possible I would have to do without the animation and only create a second graphic lower third layer where only its opacity is triggered "on" and "off" (like fade in / fade out after 5 sec).

 

 

My second idea is to separate the two actions in two scripts: the first which reads out the content of the markers and automatically creates the text and on a second layer a script which triggers the animation comp to start at the same time.

 

 

I already got specific markers labeled "hit" to trigger e.g. an effect on an adjustment layer by the other great script of Dan, but I only get this working on triggering effects, not a whole composition:

 

 

m = thisComp.layer("Layer 1").marker;

n = 0;

if (m.numKeys > 0){

  n = m.nearestKey(time).index;

  if (m.key(n).time > time) n--;

  if (n > 0 && m.key(n).comment != "hit"){

    n--;

    while (n > 0){

      if (m.key(n).comment == "hit") break;

      n--;

    }

  }

}

if (n > 0)

  linear(time - m.key(n).time,0,2,100,0)

else

  0

 

 

 

 

I tried to figure out how I get these to actions combined but unless I'm not a coder I got stuck wiht that.

 

 

Anybody has an idea who to do combine these?

 

 

Thanks


Source Text Generated by Expression - Current Value?

$
0
0

I'm writing an expression to control the sourceText of a text layer based upon the length of another text layer. Part of the functionality is to only update the current layer text if there is a large enough change in length.  Is there a way to access the current value of the text layer that was generated by the expression?  value and sourceText.text point to the text set on the text layer, not the generated layer. 

 

Here's my expression

 

 function calc(prevValue) {  var textLength = thisComp.layer(1).text.sourceText.length;  var perc = thisComp.layer(2).text.animator("Animator 1").selector("Range Selector 1").start;  var newValue = 140 - Math.floor(textLength * perc / 100);  return (parseInt(prevValue) - newValue) < 10 ? prevValue : newValue;
}

//Need to pass the previously generated text value here...how do you access it?
calc(text.sourceText);



 

Couldn't find any way to access it in the expression references.

 

Thoughts?

Calvin

Audio triggering footage based on values

$
0
0

Hello,

 

I've come across a video that I've come interested in understanding how it works...

 

I'm pretty sure it has been done manually, and not with a template that you can drag a song and it would output something like that.

 

However the idea of "triggering" footage (stock fire, logotype rotation on x-axis, etc) is bugging my mind.

 

Given values based on (a certain freq that we want to trigger the reaction) of the song, whether using some third party plugins like Trapcode Sound Keys, or by simple Convert Audio to Keyframes, I can't think of any idea on how a high value could trigger an animation on any given frame (since we have no idea when those values would be, imagine it should work for any given song). I imagine it's a possibility to have the animation of a few frame shorts, constantly looping, and easily playing with opacity could make a decent effect, but still I'm sure there must be a way to do something similar to what they've done.

 

Take for example the fire, except you have a plug-in generating it that you can control with a slider (if this would be the case, if would be really simple to do the song reaction), you can't really properly switch from footage A (fire being really low) to footage B (fire being way more crazy) without it flickering or producing some undesired effect, can you? Same question applies for footage C (3d logotype facing front) to footage D (3d logotype rotating horizontally), and even for certain freq making some stock fire appear and play just once.

 

Just wanted to show you in case someone had an idea or perhaps shared my enthusiasm on finding out how it works.

 

Thank you for taking the time to read this post.

 

Kind regards,

 

- Juan

How to make a rubber effect like when you swipe between apps using 4 fingers on iPad ?

$
0
0

Hey guys,

 

So how to make a rubber effect like when you swipe between apps (first or last app) using 4 fingers on iPad iOS7 ? Any examples ?

 

Thanks!

Ivan

Time Remapping code help

$
0
0

I'm trying to make some audio visuals for my YouTube channel, and I was trying to get an object to rotate during the song, so it would go faster when the song was louder and vice-versa

 

But when I tried my code, the object went back and forth in it's rotations, because when the music got quiet it rotated backwards

 

Could anyone help me make a code that makes sure the object only rotates clockwise, while still going faster when the music gets louder?

 

Thanks

 

-RaPiD

Layer Source Text linking to external text. (no code in doc!)

$
0
0

I've seen linking to text documents with code snippets in it.

So that means the external text document must contain bits of scripting.

 

I would like to link to txt documents (or csv) that do not contain code.

Total noob users must be able to link a text to a After Effects project.

 

I have a website data catcher which exports CSV values.

It would be ideal if After Effects can hoover up the text and put certain pieces into certain source texts.

 

We're talking automated sports cards here.

 

Is this possible without adding code to a text dump?

Or is this just impossible?

How do I script a certain layer to rotate slightly based on movement?

$
0
0

Hi guys,

So I'm trying to script partial rotation of a vector (a plane) so that as its moving either up or down it rotates slightly (by about + or - 30 degrees) and once it has reached it desired position it goes back to an orientation of 0,0,90 which is the start orientation. Anyone know how to do this or I simply have to keyframe every action?

Using sourcetext from another layer as an array - blowing up expression

$
0
0

Hey all, I am doing something that I assumed would be a quick and easy, and it is turning into quite a headache.

Here is what I am trying... (The following works btw)

 

stuff = thisComp.layer("textSource").text.sourceText;

stuff[2]

 

The problem is that if I try an index higher than 3, the expression blows up. The error is somewhat odd too...

property or method named '4' in Class 'TextProperty' is missing or does not exist. It may have been renamed, moved, deleted...

The source layer has not gone anywhere. The only thing that changes was the index.

 

I want to break down the sourceText into individual letters to feed something else and this was how I was going to go about it as I don't think the you can 'split' into letters. I figured I could get the length of the string and then scoop out each letter. Not so much eh'?

 

Update...

Tried it with split, and this also breaks it. What's odd is it seems to work for just a moment, so the script takes the index, displays the letter, waits a second, then freaks out. It does the work/breaking thing as long as the string has contains enough characters, as where a request for something that is not there immediately breaks it (which we would expect)

 

stuff = thisComp.layer("This").text.sourceText.split("");

stuff[15]


Expressions which were working fine are now crashing AE CC every single time.

$
0
0

Hi,

 

Last week I was working on a showreel template for my company and I incorporated a few expressions and sliders to try and minimise the amount of work required to add new content.

 

These expressions were working perfectly together and now after the weekend the file seems to be broken. Every time the file crashes I get this message:


"A copy of your project was saved at: XXX.aep

Last log message was: <140735177282320> <ae.blitpipe> <2> Making New Context

Generating crash log, which may take a few minutes."

 

It crashes on startup with the original file. The duplicate that AE created only crashes when I re-enable 1 of 2 of the expressions which it automatically disabled. The expression that seems to be the problem is:

 

startX = transform.anchorPoint[0];

startY = transform.anchorPoint[1];

endX = transform.xPosition;

endY = transform.yPosition;

differenceX = startX - endX;

differenceY = startY - endY;

sliderVal = thisComp.layer("Guide").effect("Blackout, Blur etc")("Slider");

currentValX = startX - differenceX*(sliderVal/100);

currentValY = startY - differenceY*(sliderVal/100);

[currentValX, currentValY, 0]

 

I hate to just copy and paste everything in here but I am completely baffled by this and After Effects offers no clue as to what the problem is. If anyone can shed some light on what the issue may be it would be much appreciated.

 

Thanks,

 

Liam

 

---------

 

Hardware Overview:

 

  Model Name: MacBook Pro

  Model Identifier: MacBookPro11,3

  Processor Name: Intel Core i7

  Processor Speed: 2.5 GHz

  Number of Processors: 1

  Total Number of Cores: 4

  L2 Cache (per Core): 256 KB

  L3 Cache: 6 MB

  Memory: 16 GB

  Boot ROM Version: MBP112.0138.B07

  SMC Version (system): 2.19f7

  Serial Number (system): C02N6C3GG3QD

  Hardware UUID: 241E1179-D911-50CA-96DB-618E6F815FEE

 

 

System Software Overview:

 

  System Version: OS X 10.9.4 (13E28)

  Kernel Version: Darwin 13.3.0

  Boot Volume: Macintosh HD

  Boot Mode: Normal

  Computer Name: Liam’s MacBook Pro

  User Name: Liam Owen (liam)

  Secure Virtual Memory: Enabled

  Time since boot: 5 minutes

Changing a value over time, based on previous frame

$
0
0

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.

Time Remap expression not working when targeting parent.parent comp.

$
0
0

I created a character rig and I'm trying to set it up so most of the keyframing is done on the main comp instead of the sub comps. Most of the body is set up in the main comp except the head which is in its own sub comp. In this Head_Comp, i have two more sub comps, SideHead_Comp, and FrontHead_Comp. In both of these comp i have the head base, eyes, eyebrows, mouth, etc.   The mouth is in its own comp set to time remap from the head comps.

 

Quick Breakdown:

Body_Comp

          > Head Comp

                         >FrontHead_Comp

                         >SideHead_Comp

                                        >Mouth_Comp

 

What I'm trying to do is be able to animate the mouth comp from the main body comp. I've done this with the eyes and eyebrows using dummy objects on the main comp, but when I try to "parent" the time remap of the mouth comp from each of the head comps to a slider in the body comp, nothing happens. The mouth comp will take the current position of the of the slider value and that's it, it won't change if I move the slider around. I'm doing it this way to avoid having a bunch of different copies of the head comps when I'm animating different scenes. I'm not exactly sure what I'm doing wrong.

 

Here is the expression I used.

a=comp("Diane - AE Rig").layer("Body_CTL").effect("Mouth_Control")("Slider")

framesToTime(a)

 

I've tried different expressions, but all it does is change to the current value and thats it. It won't move when I move the slider.

 

Thanks for any help.

How do text layer expression selectors operate on character value?

$
0
0

I'm banging my head against my desk here.  Every other attribute I try to animate using expressions selectors works by multiplying the value returned by the selector by the value of the property in question.  But I can't make heads or tails of what an expression selector does to either Character Value or Character Offset properties.

 

Has anyone had any luck with these?

 

I'm just trying to transcribe the characters from one text layer into another using the expression:

 

 

MT = thisComp.layer("Master Text").text.sourceText;
if(textIndex < MT.length) MT.charCodeAt(textIndex) else 32

 

 

I set my character value to 1, and left the Amount property set to [100,100,100] thinking the value coming out of my expression would be multiplied by 1.  Instead, the results I get are nonsensical.  Is there something obvious that I'm missing?

Track nested child layer's position

$
0
0

Hi,

 

I have a Main Comp with a layer named 'Controller'.I have several 2d layers parented to this controller.

Now,i need to precompose two of them.let's say this precomposition of these two layers is named 'precomp 1'.

How can i parent these two layers in the 'precomp1' to the 'Controller' in the Main Comp again via Expression?

 

Dan,any ideas?

Blinking Cursor

$
0
0

I have been using an expression for blinking cursor text but wanted to see if it can be enhanced.  Here is the expression that I used

 

Apply to the Text Source of a text layer

add a slider controls to the text

 

L = text.sourceText.length; 

PT = time - thisLayer.inPoint;

T = PT*effect("Speed")("Slider") - effect("Start At")("Slider")*effect("Speed")("Slider")*effect("Opacity")("Slider");

F = Math.round(PT % 1);

 

if(F == 1 | (T<L & T>0) ){Fl = "|";}else{Fl = "";}

 

 

substr(0,T) + Fl

 

 

I would like to be able to have the blinking cursor blink faster and also change it's opacity from 0 to 100 as it blinks as it draws on the text.  I am including a link to my after effects file as well as an example video of how I would like it look.

 

http://www.mediafire.com/?ggu3339l5a8o317,jv13o0b8e082fll

 

 

Any suggestions would be most appreciated.

 

Ira

Exponential Scale and Linear Move

$
0
0

Hello i'm trying to scale 2d layers exponentially. My problem — when I add 2 linear keys to move the layer — scale looks like bouncing. The expo scale code I found on adobe is <a href="https://forums.adobe.com/message/1899077">here</a>. My result comapred here: Project <a href="https://www.dropbox.com/s/41typw3o2zgsugw/Expo%20Scale.aep?dl=0">(CC)</a> or <a href="https://www.dropbox.com/s/gp0edzq00for54l/Expo%20Scale%20copy%20%28CS6%29.aep?dl=0">(CS6)</a> Please anyone help!<br> <img src="http://i1331.photobucket.com/albums/w586/amberija/Exponential-Scale-Half_zpsu5qfc4sd.gif" />


Math.sin(Math.PI) strange result

$
0
0

Hi,

 

In my AE expression Math.sin(Math.PI) gives a result of 1.22E-16, in stead of the expected zero.

Does anyone know why?

Snappier Wiggle?

$
0
0

How would you make a wiggle expression that radically reduced the time between values?  Like Wiggle that uses Exponential interpolation as inbetween values? So even though the pace would be something like wiggle(1,50), it would take much less than the 1 second wiggle interval to change between values.

 

Kind of like how a hummingbird feeds? It hovers, hovers, hovers... then snap into a new position.... hover, hover, hover... snap into new position.

 

Any ideas about this?

 

(Also, is the Jagged/Smooth option of the ancient Wiggler available in expression form?)

"No active camera" error

$
0
0

Ran into this problem tonight with a couple expressions I've used in the past in CS3+. My scene has 1 camera. It it's set to active and the eyeball is on and its in/out is the length of my comp. Is 'activeCamera' broken in CS6?

 

These expressions are turning off:

 

delta = toWorld(anchorPoint) - thisComp.activeCamera.toWorld([0,0,0]);

radiansToDegrees(Math.atan2(delta[0],delta[2]))

 

and

 

C = thisComp.activeCamera;

V = C.toWorldVec([0,0,1]);

P = toWorld(anchorPoint);

lookAt(P, P + V)[0];


Expression with delay

$
0
0

Hi,

 

I'm a nooby when it comes to expression, so can anyone please help me with how I can create a certain expression?

 

I think it's quite simple. I've got 2 layers. One layer has an animation (leader) and the other one needs to follow. Only with a delay of 1 frame. The animations happens on "position", "scale" and "rotation".

 

Thanks you very much in advance!

 

Best regards,

 

John

Text layer bounds expression problem

$
0
0

I was working on something with this, and funky stuff seems to happen when there's any lower case letter with a decender (qypj) the box acts kinda funny.

In this image[2] you can see I'm using it to center the anchor point, but the words on the left with the decenders think the text box is way bigger than it is or something and puts the anchor point up a bunch, also screwing up a beautiful set of expressions I had keeping those words in the boxes and doing all sorts of other exciting stuff.after effects.PNG

The expression: myTextLayer.sourceRectAtTime().height/2; 

(I'm only centering the y axis so pay no attention to the anchor point not being in the middle of the x axis)

This is the first time we've had this feature so maybe I'm missing something or it's a lil funky still? Any help would be appreciated!

Viewing all 47983 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>