| # Intersecting Circles• | **Intersecting Circles**
on Mar 5, 2018 at 4:18:14 am |
I want to create an animation where 2 (or more) circles intersect and a shape is created at the cross section.
As the circles move, and the intersections change, the shape should always update with the intersections.
I'm not even sure where to start with this... maybe Plexus? I have all the major plugins so if anyone has any ideas, I'm open, thanks!
Here is a screenshot of what I'm trying to achieve: https://goo.gl/YhGSDM • | **Re: Intersecting Circles** on Mar 5, 2018 at 1:31:19 pm |
Have you considered or played around with simply using different transfer modes for the various layers, probably using shape layers? • | **Re: Intersecting Circles** on Mar 5, 2018 at 2:33:36 pm |
What I need is more complicated than a Venn Diagram overlap.
Where 2 (or more) circle outlines intersect, I need to create a smaller circle that exists at those overlap points only...
Imagine 2 planet orbits crossing each other and the planets always live at the intersections.
There is a screenshot of what I’m describing in the first post. The small blue circles live on the intersections. That part is easy if this were a static image. It’s much more complicated (to me) when the circles are moving...
• | **Re: Intersecting Circles** on Mar 5, 2018 at 5:02:29 pm |
Not even vector softwares have that function AFAIK... I'm pretty sure you can't automate that in AE. I can't even begin to imagine how to do that with just circles (creating points, with position data, while regarding 2 layer's position, rotation and radius). That's some hard math you're at, and don't forget the fact that you can't create layers arbitrarily. They must be there on your timeline and just recieve the position from something.
Cassius Marques
http://www.zapfilmes.com • | **Re: Intersecting Circles** on Mar 5, 2018 at 6:11:27 pm |
it could be done.... i like math, but i'm not sure i like math enough to figure this one out right now...
here's a link to the math involved, it's not calculus by any means -- actually the math is basic high school stuff, but it would take me a while to get a working expression:
http://www.analyzemath.com/CircleEq/circle_intersection.html
you might post in the expressions forum, there's many who are better with expression and math than i am.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW • | **Re: Intersecting Circles** on Mar 5, 2018 at 6:15:59 pm |
Thats actually interesting. But for starters, we need to portrait circles as equations. can we do that? And how about three circles interacting? It easily gets pretty complicated.
Cassius Marques
http://www.zapfilmes.com
• | **Re: Intersecting Circles** on Mar 5, 2018 at 7:30:09 pm |
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 • | **Re: Intersecting Circles** on Mar 5, 2018 at 11:52:23 pm |
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 • | **Re: Intersecting Circles** on Mar 6, 2018 at 6:19:11 am |
Thanks Kevin, I will try this out this week.
• | **Re: Intersecting Circles** on Mar 7, 2018 at 8:49:21 am |
You can also pre comp the circles moving but use outlines only. Use a transfer function that will "intersect" the outlines (assuming white outlines on black - multiply would work here). So you end up with a white dot moving around on the screen where the circles edges overlap. Then either use just that as an element or track that dot(s).
| |