This library encapsulates the PathExtended
object which serves as a extension to the parent Path class of Flutter. Internally a sampled representation of the Path is stored and updated, allowing to manipulate the Path object in powerful ways.
:construction: This library is still at early-stage development and might be subject to breaking API changes!!! :construction:
Here is increasingly growing list with all available parameters and their visual effects. The animation serves for illustration purposes only. For creating such animations I would like to refer to drawing_animation, another package of mine.
Effect | Example |
---|---|
ContinousLine (default) |
|
DiscretePathEffect |
|
DashPathEffect |
|
PathDashPathEffect |
Path p = Path()..addRect(Rect.fromCircle(center: Offset.zero, radius: 2.0));
PathExtended pp = PathExtended(p)
..applyPathEffect(DashPathEffect([10,2], dashOffset: -1))
..addPath(circle(0,30.0),Offset.zero);
The API design for the PathEffect classes is inspired by PathEffect for native Android but with some differences:
PathEffect
is applied to each Path object and not to the Paint objectPathModifier
is introduced. Contrary to the PathEffect
the overall contour of the Path is changed. Internally a PathModifier
manipulates the sampled representation directly while a PathEffect
only changes the way how the sampling points are connected. This allows to combine a PathModifier
with a PathEffect
: For instance, a straight line can be transformed into a dashed sinus-curve. Soon a PathExtendedBuilder
will be exposed which allows to set up a PathExtended object without rebuilding the internal structure every time.Internal sampling rate for the path data is currently hardcoded. This might noticeable when sampling a big amount of path data (bad performance) and also for very small paths (edgy lines).
PathEffect
: How to determine optimal _delta
value for sampling. Also consider defining _delta
over amount of resulting sampling points (required for path morping). Your Path is discrete now: What happens when the Path is scaled, consider resampling dynamically.PathDashPathEffect
: Rotate Path elements according to normal of current Offset (see PathDashPathEffect.Style)PathDashPathEffect
: Implement advance
field of PathDashPathEffect by setting inital offset to -dashOffset
DashPathEffect
: Double dash pattern when odd (for now blocked by assert)PathExtendedBuilder
for better performance