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 here. My result comapred here: Project (CC) or (CS6) Please anyone help!
JimmyLiao saidJimmyLiao saidfelt_tips saidJimmyLiao saidHi every one and felt tip
I have a little problem need your help.
I have two layers. LayerA and LayerB in different positionLayerA add wiggle expression on it position property.
I want LayerB relative follow LayerA only “Y” dimension.
I can’t figure out how to do this.
Thanks
JimmyHi Jimmy,
On layer B’s position, put this…
LyrA = thisComp.layer("Layer A"); // the position offset between the layers at time 0 tOffset = thisLayer.position.valueAtTime[0] - LyrA.position.valueAtTime[0]; Pos = tOffset + [0, LyrA.position[1]];Merry Christmas!
Thanks Flet Tip
I got a error code like this
http://ppt.cc/osvlMerry Christmas to you
HaHa
I figure it out and I fixed the code fixed the problem,and I’m so happy!!
LyrA = thisComp.layer(“Red Solid 1”);
// the position offset between the layers at time 0
tOffset = thisLayer.position.valueAtTime(1) - LyrA.position.valueAtTime(1);
Pos = tOffset + [0, LyrA.position[1]];
Thank you Flet Tip
Wish you a wonderful xmas and a happy new year ahead
Oh yeah… round brackets. Ahem … just putting that in there to test you out, y’know.
Glad you worked it out.
amberija saidHello 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 here. My result comapred here: Project (CC) or (CS6) Please anyone help!
Just post the code you’re using, rather than a project file and I should be able to help you out.
felt_tips saidamberija saidHello 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 here. My result comapred here: Project (CC) or (CS6) Please anyone help!
Just post the code you’re using, rather than a project file and I should be able to help you out.
Just tried to be more convenient) Didnt expect before NY, but thank you for reply and happy holidays! Here is the code!
//applyTo: scale
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n–;
}
}
if (n == 0 || n == numKeys){
value
}else{
d = 1
try{
value[1];
d++;
value[2];
d++;
value[3];
d++;
}catch (err){
}
t1 = key(n).time;
t2 = key(n+1).time;
if (d == 1){
v1 = key(n).value;
if (v1 == 0) v1 = .0001;
v2 = key(n+1).value;
if (v2 == 0) v2 = .0001;
k = Math.log(v1/v2)/(t2-t1);
v1/Math.exp((time-t1)*k)
}else{
v = [];
for(i = 0; i < d; i++){
v1 = key(n).value[i];
if (v1 == 0) v1 = .0001;
v2 = key(n+1).value[i];
if (v2 == 0) v2 = .0001;
k = Math.log(v1/v2)/(t2-t1);
v[i] = v1/Math.exp((time-t1)*k)
}
v
}
}
Hi everyone, happy new year,
Does anyone knows how to controll the horizontal scale of a shape layer with a slider ? When i’m trying to do it, the slider controls both of the axes.
Thanks for your help
For 3d layer:
slidervalue = thisComp.layer("layer with controls").effect("Slider Control")("Slider"); [slidervalue,transform.scale[1],transform.scale[2]]
For 2d layer:
slidervalue = thisComp.layer("layer with controls").effect("Slider Control")("Slider"); [slidervalue,transform.scale[1]]
MartinLemaire saidHi everyone, happy new year,
Does anyone knows how to controll the horizontal scale of a shape layer with a slider ? When i’m trying to do it, the slider controls both of the axes.
Thanks for your help
There is my shorter version:
[effect("Slider Control")(1), value[1]]
amberija saidMartinLemaire saidHi everyone, happy new year,
Does anyone knows how to controll the horizontal scale of a shape layer with a slider ? When i’m trying to do it, the slider controls both of the axes.
Thanks for your helpThere is my shorter version:
[effect("Slider Control")(1), value[1]]
This does only work when the slider effect is on the layer that shall be moved and not on a seperate control layer.
Thanks a lot !
Hey, it’s me again
i’m still stuck, how can i parent only the vertical size of a layer to the vertical size of another layer ?
Thanks a lot for your help guys
Hello
I would like to know,If I want to generate a random number that’s say 0 to 6 in every 15 frame.
and I don’t want the number same with last number.How to do it?
number = 6; simpleT = 15; frame= Math.round(time/thisComp.frameDuration); seed =Math.floor(frame/simpleT) seedRandom(seed,true); random(1,number);
Please help me
MartinLemaire saidHey, it’s me again
i’m still stuck, how can i parent only the vertical size of a layer to the vertical size of another layer ?
Thanks a lot for your help guys
On Scale:
L = thisComp.layer("whatever"); [value[0], L.transform.scale[1]];
That looks very complicated. Are you just trying to get the layer to scale exponentially? Can I ask why particularly exponentially? Could you use an easeIn function or something like that? It’d be rather easier.
Anyway, if I understand you right, you want to put a bunch of scale keyframes on a layer and have the interpolation between them happen exponentially - so you need to get the value of the next and previous keyframe and then interpolate exponentially between them?
t = time; prop = thisProperty; if(prop.numKeys == 0) value; else if(t= prop.key(prop.numKeys).time) value; else { // get next and previous key objects nrK = prop.nearestKey(t); prevK = nrK.time>t ? prop.key(Math.max(1,nrK.index-1)) : nrK; nextK = prop.key(Math.min(prevK.index+1, prop.numKeys)); tExpExtremity = 3; // change this to increase the exponential effect tExpExtremity = Math.max(1,tExpExtremity); tElapsed = (t-prevK.time)/(nextK.time-prevK.time); // tElapsed = 1-tElapsed; // if you want the exponential to run the other way tElapsed *= tExpExtremity; tExp = (Math.exp(tElapsed)-1)/(Math.pow(Math.E, tExpExtremity)-1); //For X values val1X = prevK.value[0]; val2X = nextK.value[0]; tDiffX = val2X-val1X; valX = val1X + tDiffX*tExp; //For Y values val1Y = prevK.value[1]; val2Y = nextK.value[1]; tDiffY = val2Y-val1Y; valY = val1Y+ tDiffY*tExp; [valX, valY]; }
amberija saidfelt_tips saidamberija saidHello 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 here. My result comapred here: Project (CC) or (CS6) Please anyone help!
Just post the code you’re using, rather than a project file and I should be able to help you out.
Just tried to be more convenient) Didnt expect before NY, but thank you for reply and happy holidays! Here is the code!
//applyTo: scale
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n–;
}
}if (n == 0 || n == numKeys){
value
}else{
d = 1
try{
value[1];
d++;
value[2];
d++;
value[3];
d++;
}catch (err){
}
t1 = key(n).time;
t2 = key(n+1).time;
if (d == 1){
v1 = key(n).value;
if (v1 == 0) v1 = .0001;
v2 = key(n+1).value;
if (v2 == 0) v2 = .0001;
k = Math.log(v1/v2)/(t2-t1);
v1/Math.exp((time-t1)*k)
}else{
v = [];
for(i = 0; i < d; i++){
v1 = key(n).value[i];
if (v1 == 0) v1 = .0001;
v2 = key(n+1).value[i];
if (v2 == 0) v2 = .0001;
k = Math.log(v1/v2)/(t2-t1);
v[i] = v1/Math.exp((time-t1)*k)
}
v
}
}
Actually, on looking again, I see that’s not your problem… you already grabbed the code from somewhere else. The problem is that you’re moving the layer linearly and scaling exponentially.
If you want everything to move together, you’d need to apply the exponential code to the movement too.
felt_tips saidActually, on looking again, I see that’s not your problem… you already grabbed the code from somewhere else. The problem is that you’re moving the layer linearly and scaling exponentially.
If you want everything to move together, you’d need to apply the exponential code to the movement too.
You where right. I have two keyframes. Position and Scale.
I’m trying to make zoom to a map. Made a few project and thought of automating process for myself. So I applyed your code to scale & position both. And it was charming. Problem solved! I’m very happy because i was looking for that solution for a long time Thank you!
<img src=“http://i1331.photobucket.com/albums/w586/amberija/Expo-Solved_zpsopcbuynd.gif” /img>
amberija saidGlad it worked! :-)You where right. I have two keyframes. Position and Scale.
I’m trying to make zoom to a map. Made a few project and thought of automating process for myself. So I applyed your code to scale & position both. And it was charming. Problem solved! I’m very happy because i was looking for that solution for a long time Thank you!
felt_tips saidMartinLemaire saidHey, it’s me again
i’m still stuck, how can i parent only the vertical size of a layer to the vertical size of another layer ?
Thanks a lot for your help guysOn Scale:
L = thisComp.layer("whatever"); [value[0], L.transform.scale[1]];
It doesn’t work for me.
As you can see, i’m trying to parent the horizontal size (not the vertical) of the layer called “Background” to the horizontal size of the “Rectangle 1” contained in the layer called “Frame”, the rectangle is parented to a slider so the client can easily slide the horizontal scale.
Thanks again for your help
MartinLemaire saidfelt_tips saidMartinLemaire saidHey, it’s me again
i’m still stuck, how can i parent only the vertical size of a layer to the vertical size of another layer ?
Thanks a lot for your help guysOn Scale:
L = thisComp.layer("whatever"); [value[0], L.transform.scale[1]];It doesn’t work for me.
As you can see, i’m trying to parent the horizontal size (not the vertical) of the layer called “Background” to the horizontal size of the “Rectangle 1” contained in the layer called “Frame”, the rectangle is parented to a slider so the client can easily slide the horizontal scale.
Thanks again for your help
For horizontal size:
L = thisComp.layer("whatever"); [L.transform.scale[1]], value[0];
amberija saidFor horizontal size:
L = thisComp.layer("whatever"); [L.transform.scale[1]], value[0];
This is wrong. It should be.
L = thisComp.layer("whatever"); [L.transform.scale[0], value[1]];