Kevin Camp
Forum Replies Created
-
in regards to splitting based off capital letters, i found this thread on stack overflow:
https://stackoverflow.com/questions/7888238/javascript-split-string-on-uppercase-charactersand was able to make it work in AE with this expression:
myComp = thisComp.name.split("_")[1] ; myComp.match( /[A-Z][a-z]+|[0-9]+/g ).join(" ") ;Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
yes, it should be added to the source text property (and the sliders should be added to the text layer, or you’d need to adjust the expression).
it would help to know the error, but it might be due to the backslash in the last line. those often get converted to html character codes when posting.. i’ll try a pre format tag….
dollars = "" + effect("Slider Control")("Slider") ; year = "" + effect("Slider Control 2")("Slider") ; "$" + dollars + "B" + "\r" + "for fiscal year " + year ;Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
you need the expression to account for layer height and width when calculating the boundaries for the random position area.
if the anchor points are in the centers of each layer, this should deep them within the boundaries of the comp:
seedRandom( index, true ) ;
xSize = width * scale[0] / 100 ;
ySize = height * scale[1] / 100 ;
x = random( xSize / 2, thisComp.width - xSize / 2 ) ;
y = random( ySize / 2, thisComp.height - ySize / 2 ) ;
[x, y]I don’t know of a good way to prevent overlapping layers with a random expression…. you could work a way to manually adjust the position for overlapping layers… so the expression would do 75% of the work, but you’d need to adjust several of the layers that overlap….
to try that, set the layers’ positions to 0, 0 and change the last line to:
value + [ x, y ]
you should now be able to move overlapping layers manually.Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
you could use 2 sliders ,one for dollars and one for year. then link those values to 2 variables in the expression and construct the rest of the text needed around those variables….
so add and slider to a text layer and duplicate it, so you have “slider control” and “slider control 2”.
then try this expression:
dollars = "" + effect("Slider Control")("Slider") ;
year = "" + effect("Slider Control 2")("Slider") ;
"$" + dollars + "B" + "\r" + "for fiscal year " + year ;
then keyframe the slider values.Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
i think your looking for something like this…
for the start point:
target = thisComp.layer(index + 1) ;
target.position
for the end point:
target = thisComp.layer(index + 2) ;
target.position
this would connect the beam start point to the the first layer (circle) bellow the layer that the beam effect is on, and connect the end point to the second layer bellow the beam effect layer.Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Kevin Camp
March 6, 2018 at 11:55 pm in reply to: Is there a hotkey for Text animators (to pull them up on the timeline) or how do I customize keyboard[matt chapman] “Where do I assign hotkeys (customize keyboard). Everything I read says it is in the EDIT menu but I don’t see it.”
if your using cc18 then it’s in the edit menu, oder versions have a text file that you edit manually… to find it, choose ‘preferences’ from after effects, goto the general tab and click the ‘reveal preferences’ button.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
you could try using linear() or ease() functions…
try changing the last line to this:
myYAnim = linear( time - inPoint, 0, 1, value[1], myYHeight ) ;
[ value[0], myYAnim ]
that should animate the y position from the original y value to the calculated y height over one second starting at the in point of the layer.Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
ok, so i had some time to work this out (and found some good info online)…
you could use the circle effect, but i figured i’m the only one who ever uses that old effect these days, so i set this up to use shape layers, but you will have to center the anchor point within the layer (select the shape layer, then choose layer>transform>center anchor point in layer contents). you could also use masks on a layer however the layer would need to be the exact size of the mask — i.e., create a square solid, then double click the circular mask too to make a circular mask the exact size of the solid. you would also have to tweak the expression to use the sourceRectAtTime() function to get the size of the layers/circles, or enter those values manually.
anyway, here is the position expression to place a layer at one of the intersecting points (using circular shape layers described above):
Circle1 = thisComp.layer("Shape Layer 1") ;
Circle2 = thisComp.layer("Shape Layer 2") ;c1 = Circle1.position ;
r1 = Circle1.content("Ellipse 1").content("Ellipse Path 1").size[0] / 2;
c2 = Circle2.position ;
r2 = Circle2.content("Ellipse 1").content("Ellipse Path 1").size[0] / 2 ;d = length( c1, c2 )
if ( d > r1 + r2 ) {
value ;
} else if (d < Math.abs( r1 - r2 ) ) {
value ;
} else if ( d == 0 && r1 = r2 ) {
value ;
} else {
a = ( Math.pow( r1, 2 ) - Math.pow( r2, 2 ) + Math.pow( d, 2 ) ) / ( 2 * d ) ;
h = Math.sqrt( Math.pow( r1, 2 ) - Math.pow( a, 2 ) ) ;
x3 = c1[0] + a * ( c2[0] - c1[0] ) / d ;
y3 = c1[1] + a * ( c2[1] - c1[1] ) / d ;
x4 = x3 - h * ( c2[1] - c1[1] ) / d ;
y4 = y3 + h * ( c2[0] - c1[0] ) / d ;
[ x4, y4 ] ;
}
and here is the expression for opacity:
Circle1 = thisComp.layer("Shape Layer 1") ;
Circle2 = thisComp.layer("Shape Layer 2") ;c1 = Circle1.position ;
r1 = Circle1.content("Ellipse 1").content("Ellipse Path 1").size[0] / 2;
c2 = Circle2.position ;
r2 = Circle2.content("Ellipse 1").content("Ellipse Path 1").size[0] / 2 ;d = length( c1, c2 )
if ( d > r1 + r2 ) 0 ;
if ( d < Math.abs( r1 - r2 ) ) 0 ;
if ( d == 0 && r1 = r2 ) 0 ;
to get the other point of intersection, change the last 3 lines for position to this:
x4 = x3 + h * ( c2[1] - c1[1] ) / d ;
y4 = y3 - h * ( c2[0] - c1[0] ) / d ;
[ x4, y4 ] ;in the above expressions, change the values of Circle1 and Circle2 to be the circle layers in your comp. you’ll define those as needed to position layer that intersect other circles…
the expression does not take scale into account (it assumes that the scale of the circles is 100%), so if you are resizing/animating the size of the circles, be sure to use the size property of the ellipse paths not the scale property.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
yep, this would get more complicated… say you had circles A, B and C. you would need 2 dots to be looking just for an intersection between circles A and B, another 2 dots for B and C and 2 more for A and C.
there would need to be expressions on the dots’ opacity to set them to 0 if there was no intersection and 100 if there was. then expressions for the dots for their positions, and you’d need to figure out how to determine which or the pair of dots take one intersection and which takes the other…
and as you just mentioned, before you can do anything you’d need to determine the equation for each of the circles before you can calculate the intersections… i’d likely use the circle effect for the circles (vs a circular mask or shape layer) that way you could use the center point and radius value to generate the equation for a circle, but now we’re adding another equation into the mix…. complicated indeed.
if you know a high school math teacher who also knows java script pretty well, you could probably get this worked out… but if this is a one-and-done animation you’ll likely get it done quicker if you just create your circle animations and then animations he dots by hand.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
twirl down the text layer’s animator property and set the ‘character range’ to ‘preserve case & digits’. if you’ve typed in all caps, the character should be limited to all caps.
note that typing in ‘all caps’ is the same as having the ‘all caps’ option on for the text layer (the ‘TT’ option in the characters palette), you will need to actually add the type with the caps lock on or holding the shift key…
alternatively you can add this expression to the source text to force caps:
toUpperCase( value ) ;but this doesn’t guarantee you won’t get a number or a symbol if the character range is set to full unicode.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW