1.8.0 • Published 6 years ago
svg-util v1.8.0
SVG util
The helper utils(filter, clip etc...) for Programming SVG.
Classes
SvgDefsClass: to manage all reused elements indefsof an invisibale SVG.SvgDefAbstract Class: The reused element abstract class.LinearGradientClass: the reused linear gradient to fill.stops(IGradientColor): defines the ramp of colors to use on a gradientoffset: defined the offset of a given gradient stop. 0.0-1.0 or 0%-100%stop-color: The color attribute indicates what color to use at that gradient stop.stop-opacity: defines the opacity of a given gradient stop.
GlossGlassFilterClass: the gloss glass filter.- color(string): defaults to
#bbbbbb - specular(number): defaults to
12
- color(string): defaults to
GrayscaleFilterClass: the reused grayscale filter.LighterFilterClass: the reused lighter filter(in feComposite).BrightnessFilterClass: adjust brightness filter.- slope(number): >1 improve brightness; <1 reduce brightness: color*slope
DropshadowFilterClass: the reused drop shadow filter. NOTE: You should wrapper it to a group if you wanna apply multi-filters on one svg element.- id(string): optional to reuse the dropshadow filter.
- note: the same
idwill share the same dropshadow filter.
- note: the same
- dx(number), dy(number): the offset of the drop shadow.
- id(string): optional to reuse the dropshadow filter.
RoundedRectClipClass: the reused rounded rect clip.- id(string): optional to reuse the rounded rect clip.
- width(number), height(number): the 0-1 float number for width/height aspect ratio.
- the aspect ratio keep 6 decimal places.
- rx(number): the 0-1 float number to rounded corner radius for x.
- ry(number): optional, the 0-1 float number to rounded corner radius for y(ry = rx if no settings).
- note: the same
idand the samewidth/height ratiowill share the samerounded rect clip.
PathClipClass: the reused path clip.- id(string): optional to reuse the path clip.
- path(string): defines a path to be drawn. see
dattribute- note: the
clipPathUnitsis 'objectBoundingBox'.
- note: the
utils
domjson: used to convert the svg dom to json and reverse.svg-path: convert svg shape to the path string.