| 1 |
* convert from 360 to 100 |
| 2 |
^ /360*100; |
| 3 |
^ Example |
| 4 |
a) the second layer's opacity links to the first one's rotation |
| 5 |
b) make variable on got expression -- x = thisComp.layer("Title").transform.rotation; |
| 6 |
`with "let" gives a mistake |
| 7 |
`with "var" everything is ok |
| 8 |
c) x/360*100; |
| 9 |
* |
| 10 |
^ if we select part of text and link it to another property, it's replaced with only the part of one |
| 11 |
^ exit text-editing mode via two ways |
| 12 |
a) press "Enter" on numeric keypad |
| 13 |
b) click outside the expression field |
| 14 |
* Easy method making controlled Wiggle(); |
| 15 |
a) just with "Position" |
| 16 |
b) separate dimension on Position |
| 17 |
c) make 4 slider controls on the layer |
| 18 |
`xFr, xAmp, yFr, yAmp |
| 19 |
d) example on X Position |
| 20 |
`var xFr = effect("Wiggle X Frequency")("Slider"); |
| 21 |
`xAmp = effect("Wiggle X Amplitude")("Slider"); |
| 22 |
`Wiggle(xFr, xAmp); |
| 23 |
`animate keyframes on sliders |
| 24 |
`better if we names of variables and sliders are the same |
| 25 |
* |
| 26 |
^ we use old-fashioned programme language "Legacy ExtendScript" |
| 27 |
a) for changing into Javascript |
| 28 |
`project settings (ctrl + alt + shift + K) |
| 29 |
`Expressions > Expression Engine |
| 30 |
* Global Objects, Attributes and Methods |
| 31 |
^ comp(name) -- allows to extract another composition via its "Name" |
| 32 |
^ footage(name) -- extract an element of footage (video) with name |
| 33 |
^ thisComp -- links to the current composition |
| 34 |
^ thisLayer -- links to the current layer, light or camera |
| 35 |
a) there's no need to type 'thisLayer' because it's links to the current layer |
| 36 |
b) we can type 'thisLayer.width' or just 'width' -- the result is the same |
| 37 |
^ thisProperty -- return type is "Property" |
| 38 |
^ time -- return type is "Number" |
| 39 |
a) it shows time of composition in Seconds |
| 40 |
^ colorDepth -- return type is "Number" |
| 41 |
a) returns valuer of "color bit depth" |
| 42 |
`example: will return 16 if in composition 16 bits on channel |
| 43 |
^ posterizeTime(framesPerSecond) -- return type is number |
| 44 |
a) it allows set fps lower than fps of the composition |
| 45 |
b) example: |
| 46 |
`posterizeTime(1); -- fps will be 1 frame per second of the current property |
| 47 |
^ value -- return type is Number, Massive or String |
| 48 |
a) gives the current value for property containing expression |
| 49 |
* Methods of Converting of Time |
| 50 |
^ timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false); |
| 51 |
a) return type is Number |
| 52 |
b) type of argument 't' and 'fps' are numbers |
| 53 |
c) isDuration -- logical definition |
| 54 |
d) convert the definition 't' that returns to the definition of time of the current composition by default, to intiger of frames. |
| 55 |
e) the number of frames is shown in argument 'fps' |
| 56 |
f) argument 'isDuration' |
| 57 |
`default 'false' |
| 58 |
* ^ time -- it's converted into number which is a time of the current composition |
| 59 |
a) in the beginning of any composition time = 0 |
| 60 |
b) if we write for any object in 'opacity' |
| 61 |
`time + 20 -- it will be opacity on 20% + the number of the current composition till 100% |
| 62 |
c) if we want that object starts turning up from the 5th second |
| 63 |
`time - 5; |
| 64 |
d) negative numbers in 'time' are seen like 0 |
| 65 |
^ loopOut("offset") -- useful, don't forget, allows to make repeated animation with offset |
| 66 |
^ massive -- a parametre with loads of times values |
| 67 |
a) in massive always use square brackets |
| 68 |
^ Massive on position or scale |
| 69 |
a) example |
| 70 |
`make 2 or 3 slider controls such as: xPos, yPos, zPos |
| 71 |
`make expression on position, where: |
| 72 |
,x = effect("xPos")("Slider"); // just take pick whip from the part of expression bar |
| 73 |
,y = effect("yPos")("Slider"); |
| 74 |
,z = effect("zPos")("Slider"); |
| 75 |
,[x,y] or [x,y,z] or [x,y,0]; |
| 76 |
* |
| 77 |
^ index -- allows create duplicated layers with equal distance and equal offset |
| 78 |
a) almost ever used in complex expression |
| 79 |
b) example: position |
| 80 |
`x = index*100; |
| 81 |
`y = index*100; |
| 82 |
`[x,y]; |
| 83 |
c) next duplicated layer will shift on every 100 px to axis X and Y |
| 84 |
^ value -- it shows current definition of parametre with which we work |
| 85 |
a) value always permit to change definition by hand |
| 86 |
b) example: opacity |
| 87 |
`value + 10; // here we can change definition of parametre |
| 88 |
`if just 10 without value, we can't change definition of parametre |
| 89 |
c) if we want to use sth on massive, use [value[0],value[1]] |
| 90 |
`example: time |
| 91 |
`[time*100,value[1]] // will be change position only in axis X |
| 92 |
`but another example: wiggle() |
| 93 |
`[wiggle(2, 200)[0], value[1]]; |
| 94 |
* Expressions we make not always active |
| 95 |
^ if/else > example:position |
| 96 |
a) create variables xPos,yPos |
| 97 |
`xPos = time*300; |
| 98 |
`yPos = value[1]; |
| 99 |
b) if (xPos < 300) { |
| 100 |
[xPos,yPos]; |
| 101 |
} // it says if (xPos < 300) the condition is true, result will be [xPos,yPos] |
| 102 |
else { [300,yPos]; } // for condition is false result is X will be const, yPos stay the same |
| 103 |
c) if we put, for example 300, we should put the same number |
| 104 |
^ case sensitive -- 'a' and 'A' are difference variables |
| 105 |
* the most popular and necessary expressions |
| 106 |
^ thisComp.height -- returns height of the composition |
| 107 |
a) example: if we created a composition with size 1280x720, then expression will return 720 |
| 108 |
^ thisComp.width -- returns width of the composition |
| 109 |
a) example: if we created a composition with size 1280x720, then expression will return 1280 |
| 110 |
^ thisComp.numLayers -- returns a number of layers in your composition |
| 111 |
^ value[0] and position[0] -- it's the same expressions, howevere, position[0] is specially for parametre Position |
| 112 |
^ thisComp.frameDuration -- returns length of frames in seconds |
| 113 |
a) we can get frequancy of frames |
| 114 |
`1/thisComp.frameDuration |
| 115 |
^ numKeys -- returns a number of done keyframes on parametre |
| 116 |
^ wiggle(freq, amp, octaves = 1, amp_mult = 0.5, t = time); //default |
| 117 |
a) freq -- frequancy wiggles per second |
| 118 |
b) amp -- amplitude |
| 119 |
c) octaves -- control softness wiggles //default 1 |
| 120 |
`if more than 1, wiggles will be very sharp |
| 121 |
`ir less than 1, wiggles will be harmonious |
| 122 |
d) amp_mult -- controls damping rate //default 0.5 |
| 123 |
`from 0 to 1 |
| 124 |
`if nearer to 0, wiggles will be almost unnoticable |
| 125 |
e) t - start time // default t = time e.g. start in the current time |
| 126 |
f) example: wiggleX |
| 127 |
`freq = effect("freqWiggle")("Slider"); //for control of decay |
| 128 |
`amp = effect("ampWiggle")("Slider"); |
| 129 |
`wig = wiggle(freq, amp); |
| 130 |
`[wig[0], value[1]]; |
| 131 |
^ wiggle (start from 4th second) |
| 132 |
a) timeToStart = 4; // assigned variable |
| 133 |
b) if (time > timeToStart) { |
| 134 |
`wiggle(3, 300); |
| 135 |
`} |
| 136 |
c) else { |
| 137 |
`value; |
| 138 |
`} |
| 139 |
^ wiggle (work till the 4th second) |
| 140 |
a) timeToFinish = 4; // assigned variable |
| 141 |
b) if (time < timeToFinish) { |
| 142 |
`wiggle(3, 250); |
| 143 |
`} |
| 144 |
c) else { |
| 145 |
`value; |
| 146 |
`} |
| 147 |
d) try to use with slider controls for slight transition |
| 148 |
* Expressions which allow to repeat any animation with keyframes |
| 149 |
^ loopIn ("type", keyframes) -- repeat animation from the first keyframe till the beginning of the composition (vice versa) |
| 150 |
a) parametre (argument) "type" can have next definitions |
| 151 |
`cycle -- repeat animation as if to take keyframes and copy them one after another one |
| 152 |
`pingpong -- repeat animation forth and back |
| 153 |
`offset -- repeat animation but with shifting (useful) |
| 154 |
`continue -- continue action like it's going to the last or end keyframe |
| 155 |
^ loopInDuration ("type", time) -- repeat animation from the first keyframe till the beginning of the composition |
| 156 |
^ loopOut ("type", keyframes) -- repeat animation from the last keyframe till the end of the composition |
| 157 |
^ loopOutDuration ("type", time) -- repeat animation from the last keyframe till the end of the composition |
| 158 |
* |
| 159 |
^ Massives in AE |
| 160 |
a) coordinate of X in massive -- position[0] |
| 161 |
b) coordinate of Y in massive -- position[1] |
| 162 |
c) if we need the position in the same |
| 163 |
`[position[0], position[1]]; |
| 164 |
d) if doesn't put the |
| 165 |
^ scale[0] -- treat to scale X |
| 166 |
^ scale[1] -- treat to scale Y |
| 167 |
^ Example task: position X = 2 * Scale X; position Y = rotation + 100 |
| 168 |
a) x = transform.scale[0] * 2; // made variable for position[0] |
| 169 |
b) y = transform.rotation + 100; // made variable for position[1] |
| 170 |
c) [x, y]; // made massive |
| 171 |
* |
| 172 |
^ Task: make size of layer "Small" is = 0.45 of layer "Big" |
| 173 |
a) pickwhip scale of "small" to thisComp.layer("Big").transform.scale * 0.45; // the first method |
| 174 |
b) mul(thisComp.layer("Big").transform.scale, 0.45); //the second method |
| 175 |
^ mul() -- it's multiple on Javascript |
| 176 |
a) Vector Math > mul(vec, amount) |
| 177 |
^ Task: make size of layer "Small" is = 0.5 of layer "Big" with division |
| 178 |
a) layer("Small").transform.scale: |
| 179 |
`thisComp.layer("Big").transform.scale / 2; //the first method |
| 180 |
b) layer("Small").transform.scale: |
| 181 |
`div(thisComp.layer("Big").transform.scale, 2); //the second method |
| 182 |
^ div() -- it's division on Javascript |
| 183 |
a) Vector Math > div(vec, amount) |
| 184 |
* Creating Timer with date |
| 185 |
^ t = parseInt(effect("Timer")("Slider")); //slider control on the same layer |
| 186 |
s = t; |
| 187 |
m = t; |
| 188 |
h = t; |
| 189 |
while (s >= 60) (s -= 60); |
| 190 |
while (m >= 60 * 60) (m -= 60 * 60); |
| 191 |
m = Math.floor(m/60); |
| 192 |
while (h >= 24 * 60 * 60) (h -= 24 * 60 * 60); |
| 193 |
h = Math.floor(h/60/60); |
| 194 |
FixLen(h) + " : " + FixLen(m) + " : " + FixLen(s); |
| 195 |
function FixLen (input) { |
| 196 |
numDigits = 2; |
| 197 |
out = input.toString(); |
| 198 |
while (out.length < numDigits) out = 0 + out; |
| 199 |
return out; |
| 200 |
} |
| 201 |
^ parseInt(); -- it takes strings and returns intiger with base system |
| 202 |
a) it helps to do mathematical operations with numbers and strings |
| 203 |
b) syntax -- parseInt(string, radix); |
| 204 |
`radix -- the base of intiger in range 2 - 36 (often put 10) |
| 205 |
,notation |
| 206 |
* |
| 207 |
^ position (expression) |
| 208 |
a) initially position: 100, 150 |
| 209 |
`if in expression bar: position + 50; |
| 210 |
,it's 150, 150; //as AE add to the first argument by default. |
| 211 |
`if we want to add to both axis, 3 variants: |
| 212 |
,position + [50, 50]; |
| 213 |
,add(position, [50,50]); // formula for addition vector math > add(vec 1, vec 2) |
| 214 |
,[position[0] + 50, position[1] + 50]; |
| 215 |
`the same with subtraction |
| 216 |
^ Multiplication and Division |
| 217 |
a) unlike addition and subtraction they don't need massive |
| 218 |
b) example: 2 layers Big and Small |
| 219 |
`sc = thisComp.layer("Big").transform.scale * 0.5; //on layer small |
| 220 |
`or sc = thisComp.layer("Big").transform.scale; |
| 221 |
,mul(sc, 0.5); |
| 222 |
^ Interpolation (don't know yet) |
| 223 |
^ random(); -- gives different definitions from 0 - 1 every frame |
| 224 |
a) random(min, max); -- here we can give any range |
| 225 |
b) gaussRandom(min, max); -- similar to random(min, max), but definitions will be near average |
| 226 |
* |
| 227 |
* Position one layer between two others at a balanced distance |
| 228 |
^ animation of positions of the first and third layers |
| 229 |
^ on the seconde layer expression on position where |
| 230 |
a) pos1 = thisComp.layer("layer1").transform.position; |
| 231 |
b) pos2 = thisComp.layer("Layer3").transform.position; |
| 232 |
c) (pos1 + pos2)/2; |
| 233 |
* |
| 234 |
^ we can address to layer so |
| 235 |
a) thisComp.layer(thisLayer, -1); // address to layer which is higher, if +1, it will address to lower layer |
| 236 |
^ valueAtTime(time - 2); // useful for delaying expression for 2 seconds |
| 237 |
^ example: |
| 238 |
a) thisComp.layer("layer1").transform.position.valueAtTime(time +3); |
| 239 |
* Create a bulge with magnifier |
| 240 |
^ making layer "Magnifier" |
| 241 |
a) draw shape-layer Magnifier where use |
| 242 |
`handle |
| 243 |
`center circles group |
| 244 |
,2 circles where one less than the other one |
| 245 |
,modificator merge layers like imitation of lens |
| 246 |
^ lower increasing layer (better solid layer) |
| 247 |
a) on it effect bulge where we fit bulge to the sizes of the Magnifier layer |
| 248 |
b) on Bulge center expression where |
| 249 |
`fromWorld(thisComp.layer("Magnifier").transform.position); |
| 250 |
* |
| 251 |
^ When use 'Repeater', create a separate layer |
| 252 |
a) Much easier to center |
Комментарии