*NEW* Track Stroke Exposure

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
synthsin75
Posts: 10322
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

*NEW* Track Stroke Exposure

Post by synthsin75 »

Here's a menu/button script to track stroke exposure.
https://drive.google.com/uc?export=down ... E8rILAjsYH

Image

1. Create any shape with stroke exposure End Percentage animation.
2. Run the script.

It will create all the needed groups, reference, and animate follow path to track stroke exposure End Percentage. The "faux_camera" group can be used to animate the whole setup instead of using the camera.

If you change the stroke exposure animation, you can run the script again to update the tracking. Make changes to the original layer, which is set to hide in editing and not render.
Last edited by synthsin75 on Mon Aug 11, 2025 1:47 pm, edited 1 time in total.
Stan
Posts: 221
Joined: Sun Apr 19, 2009 7:22 am

Re: *NEW* Track Stroke Exposure

Post by Stan »

Nice script, Wes, thank you for sharing!

I should mention that there is a nasty little bug in Moho that stroke exposure percentage is calculated differently then follow path percentage. This creates discrepancies, especially when the curve contains straight lines and sharp corners.

I once tried to make a layer script that would move a pencil along the stroke exposure, and the result was not really good because of that bug.

This is an illustration of the issue - see, it works perfectly for circles but totally fails on squares:
Image

And this is an example made with your script:
Image
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
synthsin75
Posts: 10322
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Track Stroke Exposure

Post by synthsin75 »

Oh, yeah that is a pretty bad bug. Stroke exposure seems to interpolate between points according to curvature. That's strange. Exposure doesn't have any bezier keyframe handles either.

EDIT: M_Curve:GetPercentLocation(percent) doesn't even match the stroke's visual location, so this script might be as good as it's going to get for now.
Stan
Posts: 221
Joined: Sun Apr 19, 2009 7:22 am

Re: *NEW* Track Stroke Exposure

Post by Stan »

synthsin75 wrote:EDIT: M_Curve:GetPercentLocation(percent) doesn't even match the stroke's visual location, so this script might be as good as it's going to get for now.
Yeah, and this is a good example of a bug that needs to be fixed on the core application level and not on the interface level.
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
synthsin75
Posts: 10322
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Track Stroke Exposure

Post by synthsin75 »

I've reported the problem.
User avatar
synthsin75
Posts: 10322
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Track Stroke Exposure

Post by synthsin75 »

In the meantime, one thing that helps is to have less space between points on the curve. So using, Scripts>Draw>Split Curve can help the end result.

The discrepancy increases as the stroke has more ground to cover between points. It almost looks like there's a smooth interpolation from point to point, but a smaller distance is covered too quick for this to be apparent...like keyframes on the timeline.
Image
Image
User avatar
Víctor Paredes
Site Admin
Posts: 5826
Joined: Tue Jan 25, 2005 3:18 pm
Location: Barcelona/Chile
Contact:

Re: *NEW* Track Stroke Exposure

Post by Víctor Paredes »

This is very interesting. Thanks, Wes!
Did you create it with a specific idea in mind? I'm trying to think where I could use it :)
Image Image Image Image Image Image
Moho co-owner

Previously Rigged animation supervisor: My father's dragon, Wolfwalkers & Star Wars Visions "Screecher's Reach"
My personal Youtube Channel
User avatar
Maestral
Posts: 606
Joined: Tue Jan 27, 2009 8:44 am
Location: Belgrade, Serbia

Re: *NEW* Track Stroke Exposure

Post by Maestral »

To me, it looks like a perfect way of depicting birdseye view character`s tracking/following over some map or some closeup (tailoring or cutting some fabrics). Either way, some sort of extreme POV.
User avatar
synthsin75
Posts: 10322
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Track Stroke Exposure

Post by synthsin75 »

Víctor Paredes wrote:This is very interesting. Thanks, Wes!
Did you create it with a specific idea in mind? I'm trying to think where I could use it :)
This: viewtopic.php?f=13&t=32559

But it could also be used to animate following a pen as it writes.
User avatar
Shizukuishi
Posts: 77
Joined: Sun Dec 02, 2018 6:56 am
Location: Italy

Re: *NEW* Track Stroke Exposure

Post by Shizukuishi »

Hi Wes, do you still have a copy of this script? Link is broken
Even with the head in the clouds You can touch the ground

https://marisolpetretto.myportfolio.com/
https://www.linkedin.com/in/marisolpetretto/
User avatar
synthsin75
Posts: 10322
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Track Stroke Exposure

Post by synthsin75 »

Here's the new link (updated first post): https://drive.google.com/uc?export=down ... E8rILAjsYH
User avatar
Greenlaw
Posts: 10527
Joined: Mon Jun 19, 2006 9:45 am
Location: Los Angeles
Contact:

Re: *NEW* Track Stroke Exposure

Post by Greenlaw »

Somehow, I missed this one when it was originally posted, but I'm glad it resurfaced today! Will try it out shortly. :D
User avatar
Shizukuishi
Posts: 77
Joined: Sun Dec 02, 2018 6:56 am
Location: Italy

Re: *NEW* Track Stroke Exposure

Post by Shizukuishi »

synthsin75 wrote: Mon Aug 11, 2025 1:47 pm Here's the new link (updated first post): https://drive.google.com/uc?export=down ... E8rILAjsYH
Thanks a lot! :D
Even with the head in the clouds You can touch the ground

https://marisolpetretto.myportfolio.com/
https://www.linkedin.com/in/marisolpetretto/
Post Reply