Looking for a stroke script

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
troypicou
Posts: 48
Joined: Mon Dec 15, 2014 7:04 pm

Looking for a stroke script

Post by troypicou »

Just wondering if anyone knows of a script that allows you to adjust the strokes position. As it stands the stoke rides the middle of the line. I would like to have the option to have the stroke on the inside or the outside as well, like in illustrator.
Thanks for any assistance
Troy
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Looking for a stroke script

Post by synthsin75 »

Sorry, but that can't be changed by script.

Depending on what you need to do, you could mask a stroke to only show on one side of the curve or the other. But that's not likely to be very flexible.
User avatar
troypicou
Posts: 48
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou »

Thanks for the info, maybe in a future release.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw »

Just a few thoughts:

I wonder if you can fake it using a Brush pattern that is only 'half stroked'. Try making two brushes, one for inside and one for outside strokes. I think the brush would look like a half circle? Sorry, I haven't actually made a brush myself yet, so not completely sure about this.

Another approach is to paste an unstroked shape on top of a stroked shape. That will 'stamp out' the inside portion of the stroke. I imagine if you use the unstroked shape as a mask, it should trim the outside part of the stroked shape.

I know these are all just workarounds but should work if you're in a pinch.

Maybe they'll add it in a future release if you submit a request.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw »

I tried the two shape tricks and they work fine.

Sorry, TinyPic seems to be down so can't upload the test pics.
User avatar
troypicou
Posts: 48
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou »

Thanks for the suggestions!
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw »

I just tried making a half stroke brush. Yes, a 'half-circle' shape in vertical orientation works for this. To make it work, enable Align Brush With Curve, zero out Jitter and Angle, and set a lower Spacing distance to minimize 'bumps' (12 seems to work well in my test example.)

Maybe a Pill shape would work better? TBD. Also, try a half square shape.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Looking for a stroke script

Post by synthsin75 »

Great trick, Dennis!

A rectangle brush works fantastic. And you only need one with a rectangle on either the right or left side. Then depending on the direction you draw the shape will determine if the stroke is interior or exterior. Here's the test brush I created:

Image
User avatar
troypicou
Posts: 48
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou »

Thanks
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw »

Thanks for carrying that out, Wes! Glad to hear it works. :)
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Looking for a stroke script

Post by synthsin75 »

The one wrinkle is that scaling it past zero or flipping will invert the stroke. Good if you didn't draw it the way you wanted it, but bad if your animation needs to do either of those.
User avatar
troypicou
Posts: 48
Joined: Mon Dec 15, 2014 7:04 pm

Re: Looking for a stroke script

Post by troypicou »

That’s the issue I have run into Wes using this technique. Is there a way to freeze a stroke? When using them as textures and animating the stroke expansion shows. Just wondering I have been experimenting with using stokes as shadows and just looking for options. Thanks to the both of you for your input.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Looking for a stroke script

Post by hayasidist »

Greenlaw wrote:Maybe they'll add it in a future release...
this request has been around for a while in various forms - mantis 30122 -- maybe worth adding another voice and a pointer to this thread there?
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw »

Now that Tinypic is back up, here are the other techniques illustrated.

Image

For the mask technique, you'll probably want to make the mask layer a reference.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Looking for a stroke script

Post by Greenlaw »

Oh, another technique for 'outside' is to enable Outline in the Layer Property. If your shape has no stroke, this will create an outside stroke effect.

Image

This only works at render time though.

I swear, there's like a zillion ways to do stuff in Moho...and thank goodness for that. But it would still be nice to be able to just click between options for Stroke Center, Inside and Outside though. :)
Post Reply