Andreas Brand
Forum Replies Created
-
I hope I understand you right.
You want to replace the x-value of the first keyframe with the value of the slider?
If so, try this code, I hoope it helps:
x1 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = linear(time,key(1).time,key(2).time, x1, key(2).value[0]);
[x,value[1]] -
If the tip of the triangle is pointing to the middle of the red rectangle and the angular is really 45 degrees (it looks like 90 degrees) it should be something like this:
Math.tan(90-(45/2)) * (450/2)
If the angular of the red rectangle is 90 degrees it should be this:
Math.tan(45) * (450/2)
-
Andreas Brand
August 28, 2018 at 8:44 am in reply to: Switch Case in text layer returns the switch the value, Having to use switch(true)I tried it with a slider control and it didn’t worked out until I rounded the number.
Maybe this will help your problem too.
sel = Math.floor(thisComp.layer("Control").effect("Carry Forward")("First Message"));
switch(sel){
case 1:
"CARRY FORWARD PICK 6" ;
break;case 2:
"CARRY FORWARD PICK 8";
break;case 3:
"CARRY FORWARD PICK 4";
break;
} -
Andreas Brand
August 14, 2018 at 10:22 am in reply to: Change individual keyframes with Slider ControlHello Lars
You can do this with three different linear-expressions depending where the time-indicator is.
Try this code.
Hope it helps.slider1 = PICK-WHIP TO SLIDER 1;
slider2 = PICK-WHIP TO SLIDER 2;if(time<=key(2).time){
newValue = linear(time, key(1).time, key(2).time, key(1).value, slider1);
}else if(time<=key(3).time){
newValue = linear(time, key(2).time, key(3).time, slider1, slider2);
}else{
newValue = linear(time, key(3).time, key(4).time, slider2, key(4).value);
}newValue
-
Andreas Brand
August 7, 2018 at 11:54 am in reply to: create comp, create shape, import file and add track matte.Hello Scott
If you add a layer to a comp with script it always add it on top of the other layers.
In this case you add the shape layer and it is index 1. Then you add the image and it will be added on top of the other layer.
The easiest solution is to first add the image and then the shape layer.
Hope that helps.
Andreas -
Hello Ludwig
I’m not pretty sure if I understand you right.
I think you can’t reference with the same expression to the valueAtTime from another second. Because AE reads the expression every frame new.
I would do it like this:
if(time>=6){
//var scale4seconds = calculations which should affect only the scale before second six
// scale4seconds + newCalculations
}else{
// do the calculations which should only affect the scale before second 6
} -
Andreas Brand
July 27, 2018 at 6:08 pm in reply to: How to change Ellipse size to random number within range on second keyframe?Hello Louis
this code should work.
Copy it to the scale-property of one of the elipses. Then right-click to the scale-property and chosse “copy expression only”.
Then select all other elipses and ctrl+v.
Hope that helps
Andreas//This takes the markers of the comp
var beginning = thisComp.marker.key(1).time;
var ending = thisComp.marker.key(2).time;var shrinkFrom = 50;
var shrinkTo = 150;seedRandom(index, true);
randomShrinkSize = random(shrinkFrom, shrinkTo);var newScale = linear(time, beginning, ending, 100, randomShrinkSize);
[newScale, newScale]
-
Hi Romain
You can directly put the following code to the scale-property.
It uses the keys from the position-property and you don’t need an expression control property.
amp = .1;
freq = 2.0;
decay = 2.0;
n = 0;
time_max = 4;keysTotal = transform.position.numKeys;
propertyPosition = transform.position;if (keysTotal > 0){
n = propertyPosition.nearestKey(time).index;
if (propertyPosition.key(n).time > time){
n--;
}}
if (n == 0){
t = 0;
}else{
t = time - propertyPosition.key(n).time;
}
if (n > 0 && t < time_max){
v = velocityAtTime(propertyPosition.key(n).time - thisComp.frameDuration/10);
bounce = propertyPosition.value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
bounce = propertyPosition.value
}value+bounce*100
-
Andreas Brand
June 14, 2018 at 7:41 am in reply to: Move an object from one null position to another null position with Slider ControlVery fast solution!
And if you want you can use markers on the shape layer instead of an extra slider controll.
Just put two markers on the shape layer with this code in the position property:linear(time, thisLayer.marker.key(1).time, thisLayer.marker.key(2).time, pick-whip-null-1-position-here, pick-whip-null-2-position-here); -
Did I understand it right? Do you want to apply a preset with the name myPreset.ffx to a layer?
I tried this on my windows-machine and with the following code it worked fine.
Hope it will work on your machine too.
With an if/else you can ask if the system is os or not.
var proj = app.project;
var comp = proj.item(1);// Creating a textlayer with the text "Hello World"
var txtLayer = comp.layers.addText("Hello World");//Catching the Preset with the name Schreibmschine.ffx (German wording)
var myPreset = Folder(Folder.appPackage.parent.absoluteURI + "/Support Files/Presets/Text/Animate In/Schreibmaschine.ffx");//Apply the Preset
txtLayer.applyPreset(myPreset);