FORUMS: list search recent posts

Stroke width expression?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Julie Mullins
Stroke width expression?
on Sep 26, 2017 at 11:00:45 pm

Hi,

I'm trying to use this expression to keep stroke widths on shapes looking consistent no matter if the shape is scaled up or down.

http://battleaxe.tumblr.com/post/101945073972/maintain-stroke-weight-expres...

When I put then in the stroke width and don't change any of the variables, I get the error: "Error at line 0 in property 'Stroke Width' of layer 15...invalid numeric result (divide by zero?)"

When I substitute a number for 0 I get "Error at line 1 in property 'Stroke Width' of layer 15... index 5 out of range for stream of dimension 2."

What am I missing here?

s = transform.scale[4];
scaleFactor = 100/s;
value*scaleFactor;


Return to posts index

Dan Ebberts
Re: Stroke width expression?
on Sep 26, 2017 at 11:17:41 pm

It should work fine like this unless you let the layer's x scale get set to zero somehow:

s = transform.scale[0];
scaleFactor = 100/s;
value*scaleFactor;

Dan



Return to posts index

Julie Mullins
Re: Stroke width expression?
on Sep 26, 2017 at 11:44:18 pm

I found out it was because my stroke was set to 4, it doesn't work for a stroke that's set to anything below 5. I don't know why?


Return to posts index


Dan Ebberts
Re: Stroke width expression?
on Sep 26, 2017 at 11:55:23 pm

It should. What's the scale?

Dan



Return to posts index

Julie Mullins
Re: Stroke width expression?
on Sep 27, 2017 at 12:32:48 am

Actually that may not be the problem. Initially I was trying to do this on a layer that was brought in from Illustrator and converted to a shape layer. When it started "working" was when I created a new shape layer and had put the stroke width in as 5.
The layer from illustrator has multiple Groups in it. Maybe that has to do with it?


Return to posts index

Dan Ebberts
Re: Stroke width expression?
on Sep 27, 2017 at 12:42:53 am

Hard to say without seeing it.

Dan



Return to posts index


Julie Mullins
Re: Stroke width expression?
on Sep 27, 2017 at 12:57:22 am

Sorry for the multiple replies. I applied it to every Group in the layer and get both those error message. BUT I prerendered it and it seems to work fine. I don't get it, but at least it's working!


Return to posts index

Julie Mullins
Re: Stroke width expression?
on Sep 27, 2017 at 12:43:26 am

When I delete groups from a shape layer so there's only one, it works. I get a Line 0 error, but it works when I preview it. Is there a way for me to do this on a layer with multiple groups in it?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]