Hi there,
I have a question. Is it possible to make my expression to be a preset so I can use it again and again. If it's possible, how to build a control for he variable value inside the expression in the preset? Thanks
Hi there,
I have a question. Is it possible to make my expression to be a preset so I can use it again and again. If it's possible, how to build a control for he variable value inside the expression in the preset? Thanks
Version:
11.0
OS:
Mac 10.7.4
Source Footage:
.ai files
Problem:
First of all, we've been using this method for character animation since AE 7.0. We have had minor glitches here and there, but nothing consistent enough to a real problem. We're currently using CS5.5, and considering the CS6 upgrade.
I am filing an official bug report for this, but am curious if anyone else is experiencing this. I don't want to share my project here as it's for a TV show in production.
Starting with CS6, we're experiencing random, arbitary render glitches all over the place. Our character comps are generally two comps deep. Meaning in the character comp, we have timeremapped comps for sequences of eyes, eyebrows, mouths, etc. Inside those comps, there is a lot more going on than just an image sequence. We have mesh warp keyframes and other stuff.
All of this is controlled by various expressions that link everything to some simple master controls. I'm sure this sounds familiar -- it's very similar to the method used in these tutorials, but not even as complex.
As for the glitches, they are hard to pin down. There are different glitches depending on whether the character is continually reasterized in the scene or not, which comp we're in, etc. Really random. The problem is resolved by proxying those precomps (the eyes, mouths, etc) with prerendered sequences. This is an OK workaround for most cases, but we can't depend on it.
Thanks for any help. In the meantime we'll be sticking with 5.5.
Bryan
I'm trying, for the first time, to create an expression that controls a value depending on whether or not a keyed checkbox is on. This is my code.
x = comp("overlay grain").layer("frame").transform.position;
If (effect("Frame Stutter")("Checkbox") == true)
{
value = x + wiggle(25,5);
}
Else
{
value = value + wiggle(25,5);
}
When I run this, I get the error:
After Effects warning: Function If is undefined
Expression disabled.
Error occurred at line 3.
Comp: 'main'
Layer: 1 ('Date Stamp')
Property: 'Position'
I have been racking my brain over what the problem is. I have used If/Else statements in the past successfully and I know that there is just something very simple that I am missing. I have also tried using "== 1" instead of "== true", but I got the same result.
Help please.
I posted this at CreativeCOW.net in April, but have received no responses so far, thus I figured I'd post here.
I will freely confess that expressions are not my strong point. Although, I think my question will make that clear enough as I progress through it.
Let's say I have a crane setup. I've got an arm and a hook. Like so:
/,
(Mine is a little more complicated than that, but for the sake of simplicity let's pretend that's all I've got.)
I have the arm and hook psuedo-connected by a "rope" created by the Beam effect (with the start and end point of the Beam effect tied to the world positions of null objects parented to the appropriate points on the beam and hook layers). Anyway, the rope does not matter at this point.
In our situation, I want the hook to react to the motion of the arm. I want there to be inertia! A delay in the hook's movement as the arm starts moving and a continuation of the hook's movement past the arm's stopping point decaying into a standstill again.
I also need the hook to be able to move up and down - this is, after all, a crane.
I am thinking that the Y position of the hook would be caused by an Expression Control slider effect. That way the expression control slider could also be used to effect the delay/decay/amplitude of the hook's movement as it would in real life as the rope got shorter or longer.
Here's what I've tried so far:
Adapting Dan's follow the leader page I was able to get the hook to follow in a delayed manner on the x and z axis only. delay = 5;
d = delay*thisComp.frameDuration;
follow = thisComp.layer("A Boom Track").transform.position.valueAtTime(time-d);
x = follow(0);
y = effect("Drop of hook")("Slider");
z = follow(2);
[x,y,z]
I found Filip Vandueren's decay expression here.
inertia = 0.8;
stiffness = 0.1;
lagValue = calcValue(0);
f= thisComp.frameDuration;
will=0;
for (t=0; t<=time; t+=f) {
delta = calcValue(t) - lagValue;
will = will * inertia + delta*stiffness ;
lagValue +=will
}
lagValue;
function calcValue(t) {
downwardVec = toWorldVec([1,0],t);
angle = -radiansToDegrees(Math.atan2(downwardVec[1],downwardVec[0]));
return angle;
}
However, my brain is fried at the moment and I can't figure how to apply it. I'm also not quite sure that I'm headed in the right direction.
I'd like to be able to keep the distance between the hook and the arm the same (until I animate the y slider thingy, of course).
I was thinking I could use a few null objects.
Null 1 parented at the end of the boom arm.
Null 2 below it responding to the movement of Null 1 with proper decay/inertia, etc. (responding to the hook distance slider)
Null 3 also parented at the end of the boom arm, but set to rotate so that it always orients towards Null 2.
Null 4 parented to Null 3, but offset in a downward direction by the hook distance slider.
I would then tie the hook's position to Null 4.
That method, I believe would get a realistic arm and hook movement. However, my lack of knowledge is kinda screwing me at the moment.
Any ideas?
The Setup:
Comp 1 is 2000x3000 pixels. Comp 1 contains Layer X that is positioned at 1750,1250. (or whatever)
I pull Comp 1 into Comp 2 which is 800x600. I scale and move Comp 1 inside Comp 2 by an arbitrary amount.
How can I determine Layer X's position using Comp 2's coordinate space?
Hi
i'm creating an own lensfare.I have created all elements and i'm struggling with the position expression of the iris elements.
Can anyone point me in the right direction how to create the following expression=>
Example:When i move the source point of the flare to the right i want certain elements move to the left accordingly,like the build in Lensflare in after effects does.You know what i mean.Well,just pickwhiping and add *-1 doesn't really work.
any help appreciated
I am able to get soundkeys to output a 1 every time a certain audio freq. hits, but I don't know how to get it to add 1 each time it hits? currently it just goes back to zero when the freq. is not present, but I want it to count 1, 2, 3, and so on each time the audio hits.
Is there an expression someone knows about that could help me with this?
Thanks all!
Aza
I have an expression that Dan Ebberts created for number counting with a percentage sign
beginCount = 0;
stopCount = 100;
beginTime = 0; // start counting at time = 0
countDur = 4; // count for 4 seconds
"" + Math.round(linear(time,beginTime,beginTime + countDur,beginCount,stopCount)) + "%"
For my animation the layer starts around 16 seconds into my timeline and the expression has already finished before then. Is there a way to control the
in point for a layer for this expression?
Thanks very much
Ira
I am wanting to source the text for a Text layer with the following (as used by the pickwip)
thisComp.layer("Name of Layer")
However I would like to make a text style-template (as a comp, so I can use it in other comps) and then have custom text in those main comps which the template would use for the text in those instances.
So how do I target a layer in the main comp (maybe with a predefined name)?
Or is there a better way to do this?
Thanks
Hi Guys,
I tried to stay away from After Effects and concentrate on sound - but I have failed! I am hopelessly addicted to AE - there is no turning back!
I have a question about expressions. I have started getting my head around them, but was wondfering if one of you had some advice offhand on the following.
I have a scene set up - very simple, 3 Solids, one camera and a Null object - all 3d.
What I want to do now, without having to work out the math and angles (because I am lazy) is have the three solids duplicated, and placed at 45degrees on the "X" axis, in 3d space with the bottom edges touching the top edges of the layers below. I then want to duplicate again, and put a further 45degree on the "X" axis to create a ceiling. To end up with something almost, but not quite, entirely unlike this....
I would like to know if an expression can be used over a script that creates a specific shape, because I might like to add or remove solids depending on what I want to create.
To be honest, This is not something I need for a current project, but I am trying out a few things, and thought this would be an interresting place to start with expressions (having "wiggled" about as much as is alowed for one compositor!)
Thanks guys
Pierre
I got a main composition. It got a subcomposition and a null-object(with a control checkbox).
How can I access a layers opacity in the subcomposition throught an expression in the main composition?
The goal would be to reuse the subcomp. Once with a layer visible and another time without.
So far I wrote this in the control checkbox:
if(value == 1)
{
comp("subcomp").layer("xy").opacity =100 ;
}
else
{
comp("subcomp").layer("xy").opacity =0 ;
}
I tried also to write an expression directly in the going to be hidden layers opacity:
var control = comp("maincomp").layer("control");
100*control.effect(1).param("SliderControl").valueAtTime(control.time);
This actually worked when I toggled the control checkbox manually, but as soon I keyed it, it didnt work anymore.
It was kind of a time conversion problem: It takes the time of the parent but applies it to the subcomp……
Thanks for help
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
So say that I have an icon that I animate on the Y-axis +40px, but instead of trying to hand key the other layer each time, is there an expression I can write to have the other layer move in the opposite Y direction the same amount of units (ex: -40px)?
Thanks!
Hey guys, I have a project I'm working on where I want the audio (specifically the bass hit in the song) to trigger a color change of the background's color. I am almost getting the desired effect, but it is not an instant change, and seems to change multiple times for each bass hit rather than just once per beat. The other unintended effect is that when the bass beat stops completely, the color changes back to the original hue the layer has before the timeline starts. Instead, I'd like each hit to make the color change and it keep it there until the next beat. I would appreciate any and all help to try to get this to work!
First, I isolated the beat of the song and converted the audio to keyframes. I have named this keyframed slider layer "bass". Next, I am starting with a solid the size of my composition and using the Hue/Saturation effect. From there I am making it colorize the layer, writing the expression on the stopwatch of the Hue property. This is the expression I currently have:
threshold = 20.0; //audio amplitude to trigger color change
b = thisComp.layer("bass").effect("Both Channels")("Slider"); //bass layer
c = (b+(2*time)); //Hue change increment as to grow over time
accum = 0;
above = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (above){
if (b.valueAtTime(t) < threshold){
accum += 0;
frame++;
break;
}
}else if (b.valueAtTime(t) >= threshold){
accum += c;
above = true;
}
if (frame == 0){
break;
}
frame--
}
if (! above){
t = 0;
}else{
t = time - frame * thisComp.frameDuration;
}
effect("Hue/Saturation")("Colorize Hue") + accum
Any thoughts?
What I'm trying to achieve should be pretty simple but I get my head spinning on Expression Selector and for some reasons I cannot understand it, so I’m here hoping for a pro help
In a first animator I'm using a range selector to animate the position property of characters with random orders. I'd like to use an expression selector, in a second animator, using the same range selector of the first animator (with the same random orders, ease, etc.) to animate the rotation of the character from a random range (positive and negative) to 0.
Maybe a better explanation:
1 - Main question: Is it possible?
2 - Is this about textIndex or selectorValue?
3 - Is it possible to get it from a second animator or they work only when in the same animator?
4 - Is there an alternative way to achieve this?
Why? Because I need to use two specific position (with EaseIn and EaseOut at 100%) and a random range of values (positive and negative) for the rotation. Hope that it makes sense. In any case I think it might be great to have this solution (get value from another animator) for a lot of situations.
Sorry to post a question without posting any attempts, but I cannot get it.
Thanks.
Hi
First post!
I have created subtitles on a corporate video using the Metadata created from premiere.
Its working well with the expression:
L = thisComp.layer("Thatcham_Corporate_Video WITH SCRIPT.wmv");
max = 7;
gap = 2;
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){
if (time - L.marker.key(n).time < gap){
curT = L.marker.key(n).time;
i = n-1;
while(i > 0){
newT = L.marker.key(i).time;
if (curT - newT > gap) break;
curT = newT;
i--;
}
i++;
base = n - (n-i)%max;
curT = L.marker.key(base).time;
for (j = base; j < base+max; j++){
if (j <= L.marker.numKeys){
if (L.marker.key(j).time - curT > gap)break;
s += L.marker.key(j).comment + " ";
curT = L.marker.key(j).time;
}
}
}
}
s
But I need it to end the line on a full stop as it looks strange starting with 'difference. now we can...'
anyone done this before?
Luke
I know I can copy and paste a Mask Path to a layer's Position and vice versa.
But is there a way to link them live with an expression? I think I'm running into a problem with too many dimensions in an array -- I'm trying to link a Light's 3D position into a 2D Mask Shape (for Particular). I can copy and paste the motion path & mask shape between them just fine, but pickwhipping gives me an error.
Hi
how can i align the x axis of all layers along the blue line in this picture via expression?
basically the x-axis points then towards to the middle of the Comp.
<a href="http://s3.directupload.net/file/d/2029/iam4zhrw_png.htm" target="_blank"><img src="http://s3.directupload.net/images/100104/temp/iam4zhrw.png" border="1" title="Kostenlos Bilder und Fotos hochladen"></a>
I need an expression that would automatically change the font size based on how many characters are typed in.
The goal is to fit multi-line text into a bounding box as it's read from the external text file.
Does anyone know whether it's possible through an expression, or SDK by writing a plugin? So far I was unable to find any info on this topic.
Thanks for any ideas.
Hey guys,
So, I'm trying to assign the X value a null object had at the previous frame so I can continue to subtract a number from it cumulatively. I'm trying to assign it to a variable (prevframe). I'm not sure where I'm going wrong, but the line I'm trying to do it on is written as follows:
prevframe = transform.xPosition.valueAtTime(time-(1/24))
So in my mind, this should be taking a look at the value of X on the null, then looking back in time to figure out what it's value was on the previous frame (my frame rate is 24, so I'm dividing 1 second in to 24 pieces and telling it to subtract that much from the current time), and assigning whatever that returns to the variable. But it's just returning a static value, even though I'm subtracting from it. I feel like it's not the correct syntax, but I really have no idea.
I want to continue to subtract a value which is based on the velocity of another object from this, which I have worked out, I just can't figure out how to reference what this nulls X position was in the previous frame so it always returns the same value until all motion has stopped. The formula the variable is being run through looks like:
finalposition = prevframe - camvelocity
Which is then assigned to the final X position of the null object.
So, I'm not sure where I'm going wrong. I hope I've provided enough information to help someone wrap their head around this and hopefully help me solve it.
Thanks in advance,
-Seth