quote:Originally posted by Kelleytoons masking isn't *quite* as easy but gives you all the same advantages (and a few more, since the resultant shape(s) are editable -- kind of a non-destructive boolean process).

Actually, I'm wrong about this (sorry, still recovering from a bad illness and my brain isn't thinking clearly -- or at least as clearly as normal :>).

The big advantage with boolean creation is you end up with a single shape that's easy to manipulate. Watch how he creates the ear by taking a simple slice (ellipse) out of the lower corner, and then just gently shapes it. That's VERY cool -- takes a few seconds and there isn't any way at all to do that in AS.

You could mask, of course, but then you don't end up with a shape that you can edit. What you would have to do is reshape the mask AND the underlying shape but that's a PITA to try and do both.

I've used tons of graphics programs that have this feature, and I'd forgotten how much I missed it until I started watching his tutorials. For now we can't do it and there's no use fretting about it, but perhaps some day Mike will see fit to add it.

(As I said, there's no way I can see doing this in Lua -- while the tools MIGHT be there (and I doubt even that) the math would be staggering. And I used to be an math major -- well, I also used to be a genius so there's a lot of things I'm an ex at anymore. You'd have to calculate anywhere the two shapes intersected, and then add points there AND preserve the curvature of those points addition -- the latter might not be hard and I know some code I could ste... um, be inspired by. But I don't know how to calculate the intersections of ALL exterior lines of two shapes and it might not be something Lua has the functionality to do. If anyone CAN write this it would be the greatest thing since sliced bread -- it would HAVE to be something Smith Micro would incorporate into their release).

I'll share my thoughts on this so far (from my delve into "paintbrush") ... they are still incomplete / inconclusive but:

Union / Intersect (Add / Subtract) would be a breeze if we were dealing with nice neat straight-lined figures.

But it's curvature that makes things hard.... plus the "bounding box" of points is just as defined: it's points and not the curves - so curves can lie outside the bounding box; and some inspection has led me to a (partial) opinion on how curvature works. First up it looks as though it's a 3-point system: the Point that "has curvature" and its two neighbours that create a triangle (similar to a finite element of a multipoint system)... the tangent of the line through the Point is parallel to the line joining the other two points ... do this for each point, and thus create an "outer" shape with corners where the tangents intersect...

for any given "new" corner we now have two radii (some function of) the curvature at each of the two other points in its triangle ... and these are used to create a "rounded" corner. (Contrast this to SVG's rounded corner where the coordinates given are those of where the corner would be if it were not rounded...)

the “AS” and “SVG” triangles are Similar (in the mathematical sense) – but are 180 rotations of the other.

here’s the same in a picture.

SVG defines the shape using the “blue” coordinates, plus the curvatures at each point in terms of an Rx and Ry; AS defines the shape using the “red” coordinates and “curvature”, implicitly using the grey construction lines – but the result is the same “black lined” shape.

So for the LUA script, my thoughts so far are: build the “SVG” model – that will “solve” the bounding box issue (and thus make the initial determination of overlap easier); and will also probably yield a (the?) equation of the line of the curve at each apex: and so allow an algebraic solution of “crossing lines” question.

we can solve the "is the point inside or outside the new shape?" question using (and adaptation of) the even-odd fill rule: take an (arbitrary??) vector starting outside the (SVG) bounding box through the point in question and count (new shape) lines crossed.

then, as Mike says, it "only" needs the calculation of curvature at the new points...

You may be right but as this discussion continues it gets outside my pay grade (or at least my brain grade). However, let me talk in general about AS from the little I know about how curves are constructed.

There are at least two very distinct and unique ways points exist in AS, and so trying to make a global statement about how shapes are defined that doesn't take that into account is doomed to fail. Here's the example that really bugs me: create a simple circle and using add points, connect the opposite points to each other. Now delete one of the outer sides (you'll need to delete two edges). At this point (a pun intended) you now have a half-circle but the two points defining the ends are no longer *normal* points (you can't, for example, adjust their curvature). I think of them as "end points" and a shape that has one or more end points (not all of them do -- the original circle didn't, for example) behaves very differently than one that has no end points (for one thing, a shape with even one end point can't have that end point deleted without ceasing to be a shape, whereas a "normal" shape will just adjust itself accordingly to the loss of one or more points).

I offer up this weirdness because there is a logical (and, to my mind, fairly easy) routine to write boolean subtraction if this weird end point were not true (I don't want to go into it right now as it makes my head hurt even more than it already does).

Another thought: you talk about solving the bounding box issue but knowing whether a point is inside or outside of a shape shouldn't be hard at all, since you can tell (with built-in Lua functions right now) whether the mouse is pressed inside or outside of a shape (which is why fill and other effects work). That's a non-issue.

To me the one and "only" issue is curvature (and, yes, it's the big one). I can think of a couple of ways right now to write this routine IF the problem of how to construct the curve properly could be solved (that's why I don't have a clue and I really don't think it can be done in the present Lua). The fact that a point can be an end point or not only complicates this (it's not the total issue, but it does keep some trickery from solving the problem).

the "bounding box" just simplifies the question of intersection. if the boxes don't intersect then there's nothing to do; if they do overlap then it's only the segments of the curves that have one or both points in the area of overlap that need to be processed.

the "inside" point question: imagine a ">" shape with another ">" inside the arms, but not intersecting: e.g. filled paths ">>" kerned. the left > is entirely outside the right >. Points that are inside the outer path of a shape that is (to be) constructed by the union of two other shapes need to be deleted to create the single outer path of the new shape: e.g.: take two squares that overlap at a corner such that the original corner points in the overlap need to be deleted and two new points - where the edges cross - created to form a single outer bounding path of 8 points (6 original plus 2 new). Nothing as such to do with the vector where the OnMouseDown happened.

the "weirdness": yes - tried it and for sure there's something odd there! I'm in the realms of guesswork - but it seems to me that the "constructor tangent" is only extended in the same direction as the original line (i.e. in the "cutting the circle in half" example you gave, the tangent extends only in the direction of the remaining original semicircle). A very quick look at the .anme of such a shape **seems** to suggest that the weird point is (still??!!) in THREE curves (the 2 that are still there and the one that isn't ... more investigation needed! But, looking on the bright side - is there's a deterministic reason, then it's codable!

One of the compensation of the symbols, though, is that you can have references -- watch how he works with the eyes in this regard. This sort of thing could effortlessly be done in AS with layer scripts.

Thanks Mike. Your anime studio drawings are great. I like the recommendation to this site to learn flash and then apply it to anime studio. I just downloaded the free iBook, but I cannot find the flash cartoon head book for 15 dollars that you mentioned in the opening post. Did they discontinue it or rename it. Anyways thanks again.

It was fairly easy to find -- I just went to Flash tutorials, and then Drawing (they also have animation tutorials, but I suspect those are so specific to Flash they wouldn't be of much use to AS).

I bought several -- the head, the body, the retro look, backgrounds... but haven't even worked my way through the head yet (just the opening). Sigh. Too much to play with and not enough time.

"Look, I made a hat... Where there never was a hat"

I bought the "head" drawing tutorial and its been hard to get the time to watch it as I am busy with lots of stuff at the moment. I am focusing on drawing (or learning how to) first, as my animation won't be the way I want it without my characters. I am going to get a Wacom tablet ordered in the next day or two and after that, no more excuses! schemer