5 ms·
Can this also be done with a calligraphic pen? (I.e., pen with a slanted stroke). I'm asking because this is a style that is used a lot in cartoons.
by amelius 10y ago
Can this also be done with a calligraphic pen? (I.e., pen with a slanted stroke).
I'm asking because this is a style that is used a lot in cartoons.
- ygra 10y agoNot as such, no. The stroke in SVG has either a round or square end, but no arbitrary shape. Calligraphic strokes are usually represented by a filled path, which you cannot animate that way. SVG 2 also doesn't provide anything in that way. It's probably too much to ask to push path rendering with shaped brushes onto the renderer implementation when authoring tools can just as well create a filled path. You might be able to achieve something like that with a filter, which could then rely on the underlying path being animated, but I'm not sure where to begin in that case, or whether it's possible.
- deleted 10y ago[deleted]
- mxfh 10y agoYou could create stroke-width-ratios by applying SVG transformations to each path element, or groups of it. Then you have to compensate for the introduced transformation in the stroke path geometry itself. Example: http://codepen.io/mxfh/pen/RopMvr http://codepen.io/mxfh/pen/RopMvr Kind of hacky, but this could be automated by evaluating the stroke transforms and applying the reverse transforms to source path geometry for compensation.
- amelius 10y agoWow, looks useful! I didn't realize that it could actually be that simple :) But of course applying the inverse transform to arbitrary paths could still be a tricky mathematical operation.
- jacobolus 10y agoIf you’re willing to use the canvas instead of SVG, it’s even easier. You can draw the path in one coordinate system, then change the coordinate system for the action of stroking the path, which will not change the location of the path on screen but will let you effectively make the stroke into an arbitrary ellipse.
- bencroskery 10y agoActually doing this in a project I'm working on right now. The solution is to use the pen vector as a clipPath over an underlying line which is animated to fill the calligraphy.