• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Driving mask stroke with gradient

Explorer ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

I have a bunch of masks created with auto-trace. I've applied a few effects to these: stroke, turbulant displace and roughen edges.

I was looking at this tutorial in regards to controlling the stroke with a gradient, so as my gradient expands radially from the centre of the comp the masks will get traced in order, following the motion of the gradient.


https://www.youtube.com/watch?v=4OQN2mHQuD0&t=406s 

 

here's the expression he uses:

sourceLayer = thisComp.layer("Transition Control 2");
sampleSize = [1,1];
samplePoint = transform.position;
colour= sourceLayer.sampleImage(samplePoint,sampleSize);
x=colour[0]*100;
[x,x]


In the tutorial he samples the transform position of an individual shape, but can I sample the anchorpoint of each individual mask within my layer in order to drive the stroke effect? What would the command be in the expresion to sample the mask position? The end result I'm hoping to achieve is a radial reveal of linework (my masks) from the centre out.

TIA for any help. I'm a real hack with AE but this workflow has the potential to be really useful to me if I can get it working.

TOPICS
Expressions , How to

Views

527

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

You cannot sample the masks directly. You would explicitly have to create Nulls from the anchor points and then possibly mess around with more mask path expressions. That being the case and the whole technique generally sounding fishy and rather unreliable (What happens, if masks self-intersect or circle back to the center for instance?) there's probably a better and simpler way to do it, but without actual info about your project and screenshots nobody can advise on that.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Thanks, I thought it sounded a bit optimistic. I have converted the masks to shapes with one of the redefinery scripts (all 870 of them!) so I wonder if these could be tested, although it seems that sub-shapes don't have their own pivot information, so probably not.

Here is the layer I have - a shape layer with many sub shapes, or a solid with many masks and a stroke effect.

Screenshot 2022-04-29 091140.png

the effect I'm trying to achieve is for these to be 'sketched' from the centra outward (or maybe from a few arbitary points outward. Of course I could just mask and reveal, but the idea of driving a trim paths effetc was to draw each individual sub-shape from start to end in a roughly radial order from he centre. Of course there will be some discrepancy depending on where the sub-shapes lie, but the overall effect I think would be more organic than just a sinple mask reveal.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

I was gonna say if you're using a stroke effect on a single layer set to "All Masks" you can just drag the masks in the layer stack and arrange them in the order you want them to reveal and set their "first vertex" for a little extra variation but with over 800 masks that would get pretty tedious and you'd have no offset.  

~Gutterfish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

I would do it differently. Apply a uniformely timed stroke to all your shapes, pre-compose and use the Time Displacement effect. That way you can simply control the delay with a greyscale version of your map and some gradients. Using multiple such layers can easily create the illusion of varied timing and the map spreading out from different origin points. It'S still a bit of work, but definitely more controllable and intuiive than trying to use expressions that would slow down things to a crawl. You really have way too many shapes to even dream of that. Even animating every stroke by hand would likely be faster than waiting for 800+ expressions to evaluate for every frame, especially since sampleImage() itself is one of the slower methods to begin with.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Thanks for the tip! I'll try that. Like I say, I'm a hack, so didn't know about the time displace effect

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2022 Apr 30, 2022

Copy link to clipboard

Copied

I have often created this kind of write-on effect using an animated gradient as a track matte. If you start the artwork in Illustrator, you can add a gradient to the stroke, set the gradient to start at the first vertex, release everything to layers, import it as a comp, then sequence the layers, add an animated color correction, then use the comp as a track matte for a solid to simulate drawing each shape in order. I don't have time to build an example right now, but this workflow will be faster than trying to sample colors on a hundred layers.

 

I hope that workflow makes sense to you.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 30, 2022 Apr 30, 2022

Copy link to clipboard

Copied

Thanks, I think it does! Anyone though my company won't pay for illustrator. Sounds like a solid workflow though. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Apr 30, 2022 Apr 30, 2022

Copy link to clipboard

Copied

You shouldn't care more about a project than the people you're doing the work for.  Save yourself the headache and do a simple mask reveal.  You're costing yourself money taking a week to do something that could have been done and acceptable.   Cynical, I know.  But that's my experience. 

~Gutterfish

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 06, 2022 May 06, 2022

Copy link to clipboard

Copied

LATEST

Ok, so I think I have this working now. I tried a few of the suggestions but couldn't achieve the desired effect, so I've reverted to my original idea, yesit's slow, but it works.

Auto Trace the rendered RGB matte to get the mask outlines

Convert these masks to nested shapes with redefinery maskstoshapes script and add a thin stroke

Explode to individual shapes with ESL3 script (this takes a while)
copy the scripted trim paths effect to all these shapes, referencing an expanding radial gradient layer
pre-comp these to a 3D layer, add camera and zoom out following the line expansions, I'm going to add layer style stroke and turbulant displace/roughen edges on to these 3D layers as it will be easier to mass-control the effects for each element

Additionall the 3D comp is 8k! as I start very zoomed in. Slow but it works. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines