Found this site:
web.cs.wpi.edu/~matt/courses/cs5 … eform.html
So I tried reproducing the same effect on Synfig:
freeform-deform.sif (41.5 KB)
There’s still an issue that makes the deformed shape not follow the bezier as closely as it should.
If you want to play with it you can edit (and animate) the P0, P1, P2 (to control the deformation bezier) and the point0, point1, point2, point3 (to control the shape being deformed, ie. two straight lines).
The magenta circles represent the original shape, the green circles the deformation bezier and the orange circles the result deformed shape. The other circles represent various intermediate steps, you can enable them if you want to see a bit of the inner workings.
Fixed issue mentioned in opening post. Now the deformed shape closely follows the deformation bezier:
freeform-deform.sif (58.6 KB)
Also added a “window” rectangle which can be used to control how the shape is mapped onto the deformation bezier. The horizontal line in the middle of the rectangle matches the deformation bezier (ie. if you place a line over that line, the deformed curve will match the deformation bezier).
Now only need to implement this in a easy-to-use plugin.
Need to figure out how to turn the resulting curves back into beziers. If I’m not mistaken, the result of deforming a straight line with a quadratic bezier should be a new quadratic bezier. I think the middle control point for it can be calculated by analyzing the tangent directions at start/end of the result curve and then finding the intersection.
Finally got a working version of plugin script. First results:
yoyospline.sifz (2.82 MB)
There’s some limitations though:
- Works only on a single layer at a time (the last layer on the file, which must be an outline or region layer)
- Ignores tangents, so the source shape can only have straight edges
- Generates big files due to the way Synfig handles unexported linked nodes (ie. the XML is duplicated at each linked site)
The source shape can be edited/animated after the effect is applied (adding/removing points from bline is not supported, though). The window (ie. semi-transparent black rectangle) and be edited/animated also (maybe useful to make scrolling effects). And as shown above the control bezier can be animated as well.
Plugin files (extract to Synfig’s plugin directory, restart Synfigstudio, then select from Plug-ins menu to execute):
freeform.zip (6.73 KB)
Github repo for sources:
think that this serious interesting to generate intercalations of morphologies of drawings (in pixel)