0.1.1-alpha.1 • Published 4 years ago

primitivo-svg v0.1.1-alpha.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Primitivo-SVG (Alpha) - JavaScript library for SVG

Primitivo is a JavaScript library for SVG. That means it prepares data for the SVG and doesn't manipulate the DOM. Think about it as the SVG assistant. With it, you can create spinners, transitions effects, or elements for illustrations.

What makes it unique

  1. Morph paths via animate tag;
  2. Powerful timing and spacing controls;
  3. Phased animation;
  4. Animate with SSR and turned off JS (except for interactive cases).

Examples:

CodeSandboxes:

  1. Sequence of polygons
  2. Smart round
  3. Noise of distance
  4. Phased transition
  5. Blobby Spinner

Collections of examples:

Collections of design concepts:

  1. Dribbble: https://dribbble.com/Guandjoy/buckets/1504217-primitivo
  2. Pinterest: https://www.pinterest.com/yurko_turskiy/primitivo/

Buy me a coffee :coffee:

Coffee will help me to develop Primitivo faster.

Bitcoin wallet: 19fxW81ApuCbAu2tW8WebxRQqaoje6YbhJ

Install:

npm install --save primitivo-svg

Backlog:

  1. Corners rounding and smoothing

Path Layer

Draw a figure

base parameters:

NameDescription
numOfSegments?: number;
depth?: number;
x?: number;
y?: number;
width?: number;
height?: number;
centerX?: number;
centerY?: number;
rotate?: number;
numOfGroups?: number;
groups?: GroupParameters[];

Group Parameters

NameDescription
typelinear or radial
incircle
distance
round
smartRoundAble to create perfect circle from a polygon with custom radians
lengthBasedRoundThe longer distance from center the bigger round factor is
adaptArmsKeep arms always perpendicular to center
radius
radiansCustom radians for each point of a group

Morping Layer

Draw a sequence of paths

parameters:

NameDescription
numOfKeyPathsNumber of key paths (frames)
loopLoop the animation

keyPathsParameters:

NameDescription
numOfSegmentsNumber of segments of the path frame
depthPow the number of segments
xX coordinate of the top left corner
yY coordinate of the top left corner
widthThe width of the frame
heightThe height of the frame
centerXX coordinate of the center point
centerYY coordinate of the center point
rotateRotate the figure
numOfGroupsLimit the number of groups
groups:Array of groups settings
- typeLinear of radial
- distanceDistance from center
- roundValue of the round strength
- incircleKeep points in circle's boundaries

Spacing Layer

Calculate keySplines for a defined timing and spacing.

Phases Layer

Make complex sequence of paths based on input parameters

Parameters:

NameDescription
numOfSegmentsNumber of segments of the path frame
depthPow the number of segments
xX coordinate of the top left corner
yY coordinate of the top left corner
widthThe width of the frame
heightThe height of the frame
centerXX coordinate of the center point
centerYY coordinate of the center point
rotateRotate the figure
numOfGroupsLimit the number of groups