Giter Club home page Giter Club logo

lazy-line-painter's Introduction

Lazy Line Painter

Bundle Size GitHub Release License npm Version

Lazy Line Painter

A Modern JS library for SVG path animation

Getting Started | Documentation | Examples | Lazy Line Composer



Getting Started

Lazy Line Painter Lazy Line Painter can be setup with minimal effort as per the Quick Start instructions.

However if a GUI is more your thing, be sure to use the Lazy Line Composer.
A free Online Editor developed specifically for SVG path animation.


pnpm i lazy-line-painter
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/lazy-line-painter-2.0.3.min.js"></script>
<script src="./libs/lazylinepainter-2.0.3.js"></script>



Quick Start

The most basic, no-frills implementation;

// import LazyLinePainter
import LazyLinePainter from "lazy-line-painter";

// select your svg
const el = document.querySelector("#my-svg");

// initialise & configure LazyLinePainter
const myAnimation = new LazyLinePainter(el, { strokeWidth: 10 });

// paint! :)
myAnimation.paint();



Documentation


Configuration

Configure on initialisation

On initialise you can pass lazylinepainter a config object as an argument containing the attritubes you wish to alter across the entire svg.
All config properties are optional.
Style attributes set in the config will override css styles.

const config = {

	// style properties
	'strokeWidth'     // Adjust width of stroke
	'strokeColor'     // Adjust stroke color
	'strokeCap'       // Adjust stroke cap  - butt  | round | square
	'strokeJoin'      // Adjust stroke join - miter | round | bevel
	'strokeOpacity'   // Adjust stroke opacity 0 - 1
	'strokeDash'      // Adjust stroke dash - '5, 5'

	// animation properties
	'delay'           // Delay before animation starts
	'reverse'         // reverse playback
	'ease'            // penner easing - easeExpoOut / easeExpoInOut / easeExpoIn etc
	'repeat'          // number of additional plays, -1 for loop
}

const svg = document.querySelector('#my-svg')
const myAnimation = new LazyLinePainter(svg, config)

Configure individual paths

Data attributes can be used to configure style & animation properties on individual paths in the SVG.
Data attributes will override both css styles & initialisation config style attributes.

<path 

  // style 
  data-llp-stroke-width="10"
  data-llp-stroke-color="#000000"
  data-llp-stroke-opacity="0.5" 
  data-llp-stroke-cap="rounded" 
  data-llp-stroke-join="mitre" 

  // animation
  data-llp-stroke-dash="[2,2]" 
  data-llp-duration="200" // (ms)
  data-llp-delay="200" // delay offset from start of timeline (ms)
  data-llp-reverse="true" (default = "false") 
  data-llp-ease="easeInOutQuad" (default = 'easeLinear') 

  />



API Reference

Methods

Paint - accepts optional playback arguments - reverse, ease, delay

const reverse = true;
const ease = "easeExpoOut";
const delay = 200;
myAnimation.paint({ reverse, ease, delay });

Erase - paint can still be called on the element after it has been erased;

myAnimation.erase();

Pause

myAnimation.pause();

Resume

myAnimation.resume();

Progress

// set - [0 - 1]
myAnimation.progress(value);

// get
const progress = myAnimation.progress();
console.log(progress);

Destroy - destroys svg & lazyline instance

myAnimation.destroy();



Events

Handle events across entire animation
myAnimation.on("start", () => {});
myAnimation.on("update", () => {});
myAnimation.on("complete", () => {});
Handle all events

Called for each shape animated within the svg.
event argument contains shape properties.

myAnimation.on('start:all', (event) => {});
myAnimation.on('update:all', (event) => { console.log(event.progress); // [0-1] });
myAnimation.on('complete:all', (event) => {});
Handle targeted events.

Listen to events on specific shapes by adding the shape-id after the colon.
event argument contains shape properties.

myAnimation.on("start:id", (event) => {});
myAnimation.on("update:id", (event) => {});
myAnimation.on("complete:id", (event) => {});
Timeline playback events
myAnimation.on("pause", () => {});
myAnimation.on("resume", () => {});
myAnimation.on("erase", () => {});





Changelog

Refer to Release notes for entire Changelog



Author

https://merriment.info/

lazy-line-painter's People

Contributors

camoconnell avatar inorganik avatar patrick91 avatar saeedseyfi avatar spirit55555 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazy-line-painter's Issues

Reverse animation direction

It would be suuuuper helpful to have a means of reversing the animation direction (which point is the starting point) for each stroke in the converter.

It's possible I'm missing something, but I've found that editing the resulting text/JS is tough to figure out for curved strokes.

Error: svgData is undefined

Hello,
i get following error in console:

TypeError: c.svgData[d] is undefined
...eKey?c.overrideKey:b.attr("id").replace("#",""),f=c.svgData[d].dimensions.width

and if i embed the minified JS file then i get this error:

TypeError: options.svgData[target] is undefined
var w = options.svgData[target].dimensions.width;

Use with skrollr

Hi! I really enjoyed using this plugin. Is it possible to use this with Skrollr.js? If yes, how do I do this?Thanks!

svgData[target] Error

I am getting the following error and no painting happens:

TypeError: options.svgData[target] is undefined
var w = options.svgData[target].dimensions.width;

The width seems to be set both in the js and css and I have not changed anything in the lazylinepainter.js file.

If anyone is available to help me troubleshoot this I would greatly appreciate it.

I am using v1.5.1

How to prevent remaining callbacks from firing when user presses 'reload'?

I have a complex animation with nearly 50 svgData sets. If the user presses 'reload' in the middle of the animation - the remaining callbacks still execute at the same time that the animation reloads... is there a way to prevent this?

You can see it live (use Chrome - b/c there is a safari console error for reload in 1.6.1 & 1.6.2)
CodePen

process.php

can you include process.php into this repo?

Can't see animation in Safari 5.1.10

The only browser I can't see the plugin working is in Safari 5.1.10 on Mac.

I'm interested in using it if it works in Safari too.

Am I missing something?

Scale your svg

I was wondering how to scale your svg.
Thats pretty easy

add a ratioScale option parameters, with default : 1

and put that parameter with setviewbox function in init :

init: function(c) {
        return this.each(function() {
            var a = e(this),
                b = a.data("lazyLinePainter");
            a.addClass("lazy-line");
            if (!b) {
                var b = e.extend({
                    width: null,
                    height: null,
                    strokeWidth: 2,
                    strokeColor: "#000",
                    strokeCap: "round",
                    strokeJoin: "round",
                    ratioScale : null,
                    strokeOpacity: 1,
                    strokeDash: null,
                    onComplete: null,
                    delay: null,
                    overrideKey: null
                }, c),
                    h = null === b.overrideKey ? a.attr("id").replace("#", "") : b.overrideKey,
                    f = b.svgData[h].dimensions.width,
                    k = b.svgData[h].dimensions.height;
                b.svgData = b.svgData[h].strokepath;
                null ===
                    b.width && (b.width = f);
                null === b.height && (b.height = k);
                h = a.attr("id");
                f = new Raphael(h, f*b.ratioScale, k*b.ratioScale);
                f.setViewBox(0,0,b.width / b.ratioScale,b.height / b.ratioScale,true);
                a.data("lazyLinePainter", {
                    svgData: b.svgData,
                    width: b.width,
                    height: b.height,
                    strokeWidth: b.strokeWidth,
                    strokeColor: b.strokeColor,
                    strokeCap: b.strokeCap,
                    strokeJoin: b.strokeJoin,
                    strokeOpacity: b.strokeOpacity,
                    strokeDash: b.strokeDash,
                    onComplete: b.onComplete,
                    delay: b.delay,
                    overrideKey: b.overrideKey,
                    paper: f,
                    count: 1,
                    complete: !1,
                    playhead: 0,
                    setTimeOutHandler: []
                })
            }
        })

Then in your constructor :

 $(document).ready(function(){ 
   // Setup your Lazy Line element.
    // see README file for more settings
    $('#svg').lazylinepainter({
        'svgData': svgData,
        'strokeWidth': 1,
        'strokeColor': '#ffffff',
        'ratioScale' : 2,
        'onComplete': function() {

        }
    })

    // Paint your Lazy Line, that easy!
    $('#svg').lazylinepainter('paint');
 });

your svg is 2x time larger.

It works with the very very last version of Raphael. ( viewbox problem with under version of raphael ! )

Keep going !

Smoother animation

Hi! Just want to share an idea. It is possible to use css-transition n stroke-dasharray to create nice painting animations.

Benefits:

  • super performance (even on mobile)
  • smooth animation

Here is my small example -- http://codepen.io/H1D/pen/KhgFw

Dot's Before Drawing on IE

Hi this is an issue that seems to effect version 1.5 - 1.7 on Internet Explorer 11 and 10.

Before the lines are drawn on the start points appear as little circles like so:-

lazy-problem

I'm happy to provide more information if it helps.

SVG Illustrations coming out inaccurate/glitched

Hello!
So I was having simillar issues with this in the older version, but I was hoping 1.5 would fix my problem. Looks like it's still happening (to a degree).

My illustrations are coming out with some weird glitches, like lines not being in the right place or not appearing at all. For example, this is what my illustration looks like in Adobe Illustrator:

image

And this is how it looks when uploaded to the Lazy Line Converter:

image

Any idea what's going wrong here? Maybe I'm using the wrong techniques in my AI file? Or I'm saving as an SVG in the wrong way? Any ideas?

Thanks!
E

Erase method defect

'Init' method, count is set to 1:
'count' : 1,
'Erase' method, count is set to 0:
d.count = 0;

  • but should be 1. Consequent calls (with callbacks) of 'Paint -> Erase -> Paint' didn't work for me, changed count to 1 in 'Erase' method and it worked.

Continuous animation

Hi there! Can I get some help -

I need to have this continuously animate, i.e. have the entire drawing disappear and then redraw. Is there an easy way to go about do so?

online converter adds a seemingly arbitrary start point representing the top of the artboard

Hi - I noticed that when you use the online converter to convert an svg file created in illustrator - it creates a start point at what I believe would be the top of the artboard in illustrator, at the X coordinate where the art would start (but not the Y coordinate). I've attached two images, one of which is drawn by the converter, and the other representing what is desired.

I was able to fix the code in all cases by removing the first set of coordinates in the move commandand moving the first set of coordinates in the line command to the move command. Thus instead of

M [X1],[Y1] L [X2],[Y2] [X3],[Y3] ...

you would have

M [X2],[Y2] L [X3],[Y3] ...

I've also posted my SVG file here:

http://mikeheavers.com/transfers/test.svg

screen shot 2015-01-12 at 9 53 10 am
screen shot 2015-01-12 at 9 53 16 am

Across multiple paths, you get a sort of "etch-a-sketch" effect in which the path drawer doesn't pick up its pen.
screen shot 2015-01-12 at 10 00 34 am
screen shot 2015-01-12 at 10 00 49 am

Regardless, thanks for a great library - will still save me lots of time with what I'm trying to build.

Speed of lazy line painter

Hello,

Hope you are in the best of health, wanted to inquire that how can we manage the draw speed of the animation ? thanks in advance.

Regards,
Kamil

Doesn't work in mobile browser

Hello there,

I use 1.5.1 version, and create an animation of my svg, But in mobile browser (android phone), it shown blank.

No stroke-dasharray available via CSS

Hello people.

First of all excuse my English. Hope you can understand the point.

From the code in the jquery.lazylinepainter.js file I can gather (from my lack of better knowledge of JavaScript and jQuery) that the dasharray allows the script to animate the line. How can I alter this property so I can have, lets say, a dashed line or a dotted one?

Thanks.

--Update--

I tried adding the property in the var of the pathObj (Were all the info from the SVG goes) but it doesnt work, also tried in CSS with div > svg > path { stroke-dasharray: 5,5 } and it makes it dashed but not animated.

Responsive width and height

Is there anyway of creating a svg with a percentage so when you reduce the screens width & height it fits? I assume there's no way of doing this as it's already a coded svg

TypeError: n is undefined

I get the error TypeError: n is undefined in Firefox and Uncaught TypeError: Cannot read property 'x' of undefined in Chrome.

This is what I'm using

var pathObj = {
"move-down": {
"strokepath": [
{
"path": "M0.9,22.9C0.9,10.7,10.8,0.8,23,0.8c12.2,0,22.1,9.9,22.1,22.1S35.2,45,23,45S0.9,35.1,0.9,22.9",
"duration": 600
},
{
"path": "M0.9,22.9C0.9,22.9,0.9,22.9,0.9,22.9",
"duration": 600
},
{
"path": "M33.2,18.3l-10,10l-10-10c-0.3-0.3-0.8-0.3-1.1,0s-0.3,0.8,0,1.1L22.7,30c0.1,0.1,0.3,0.2,0.5,0.2 s0.4-0.1,0.5-0.2l10.6-10.6c0.3-0.3,0.3-0.8,0-1.1C34,18,33.5,18,33.2,18.3z",
"duration": 600
}
],
"dimensions": {
"width": 46,
"height": 46
}
}
};

$('#move-down').lazylinepainter({
    "svgData": pathObj,
    "strokeWidth": 2,
    "strokeColor": "#e09b99"
}).lazylinepainter('paint');

What is wrong with my code?

Uncaught TypeError: Cannot read property 'dimensions' of undefined

var svgData = {
"mobilephone29": {
"strokepath": [
{
"path": "M647 2539 c-60 -46 -57 31 -57 -1259 0 -1294 -4 -1215 59 -1259 29 -21 38 -21 631 -21 593 0 602 0 631 21 63 44 59 -35 59 1259 0 1294 4 1215 -59 1259 -29 21 -37 21 -633 21 -594 -1 -603 -1 -631 -21z m1221 -171 l3 -88 -591 0 -590 0 0 83 c0 46 3 87 7 90 3 4 268 6 587 5 l581 -3 3 -87z m2 -1073 l0 -875 -590 0 -590 0 0 875 0 875 590 0 590 0 0 -875z m-2 -1082 l-3 -108 -585 0 -585 0 -3 108 -3 107 591 0 591 0 -3 -107z",
"duration": 800
},
{
"path": "M1244 278 c-24 -11 -44 -48 -44 -79 0 -31 44 -69 80 -69 36 0 80 38 80 69 0 33 -21 68 -47 80 -29 13 -41 13 -69 -1z",
"duration": 600
}
],
"dimensions": {
"width": 256,
"height": 256
}
}
};

    $(document).ready(function(){ 
        $('#logo').lazylinepainter( 
            {
                "svgData": svgData,
                "strokeWidth": 2,
                "strokeColor": "#e09b99"
            });

        $('#logo').lazylinepainter('paint'); 
     });

What is wrong with my code?

draw point styling

Hi - I'd love to use this to show a hand drawing the lines - is it possible to style an element positioned at the drawing point?

LazyLinePainter Uncaught TypeError

I've followed the instructions, and got it almost working.

I'm using Bootstrap framework and added scripts at the bottom of the page.

Looks like they are all loading, but I get this error when I load my page:

Uncaught TypeError: Cannot read property 'dimensions' of undefined

I'm using jQuery 1.9.1.

Can you tell me what the issue could be, or what am I doing wrong?

Thank you in advance.

Converter

Hello,

Would it be possible to have your converter in the source?
To use svg larger than 40kb.

Latest version of Raphael removes curves when using 'paint' method.

I tried this plugin with the latest, minified version of Raphael JS and it resulted in angular strokes on some paths when using the 'paint' function. The 'stamp' function works fine. Using the version of Raphael that came with the plugin fixed the issue for me so I haven't investigated further.

screen shot 2013-10-21 at 5 59 54 pm

online converter is not working

Hello! Tried to convert different svg images (made by myself or found on different sites) - and any of them was converted. Can you comment this situation please? Thanks in advance

LazyLinePainter - Implement multiple pathObj(s), containing sequential and non-sequential paths, with delays on individual paths

The question for LazyLinePainter (LLP) is 3-fold - each of which ties in with the other and I believe a clear answer will help all those looking to animate complex SVGs.

1 How to get LLP to sequentially execute multiple pathObj(s), back-to-back?

2 How within each pathObj to get LLP to sequentially execute a path, then simultaneously execute multiple paths, followed by another sequential path?

3 Lastly, how to apply "delay" to individual paths contained inside of a pathObj

The SVG logo in question that I've created can be seen at codepen.

When I drop the logo into LLP - it animates it just fine- in the initial sequential order. Yet my problem is that I need certain groups of element paths to animate together and I need others to animate sequentially.

I've tried placing all of the pathObj(s) paths within one pathObj - but to no avail. I've also tried using the 'onComplete' on a path and on the pathObj - neither of which seemed to work. Short of breaking out my SVG into dozens of independent DIVs and then ** manually calculating the delay on each and every DIV ** - I don't know how to make this work...

Essentially - it is unclear to me the best methodology to use to animate some paths together, other others sequentially, string together multiple pathObj(s), and apply delays to individual paths within a pathObj.

As of right now my SVG is organized like this:

<g id='Logo_Group1'>  //1st pathObj
       <path> //path runs sequentially
       <g id='section1'> //group should run sequentially, but paths within should run simultaneously
             <path> *stroke-width: 1*    //paths run simultaneously
             <path> *stroke-width: 18*   //paths run simultaneously
             <path> *stroke-width: 18*   //paths run simultaneously
             <path> *stroke-width: 1*    //paths run simultaneously
       </g>
       <path>  //path runs sequentially
</g>

<g id='Logo_Group2'>  //2nd pathObj
       <g id='LG2-1'> //group should runs sequentially, but paths within should  run simultaneously
             <path> *stroke-width: 1* ,  //paths run simultaneously
             <path> *stroke-width: 1*    //paths run simultaneously
             <path> *stroke-width: 2*    //paths run simultaneously
             <path> *stroke-width: 1.5*  //paths run simultaneously
       </g>
       <g id='LG2-2'> //group should runs sequentially, but paths within should run simultaneously
             <path> *stroke-width: 1*   //paths run simultaneously
             <path> *stroke-width: 2*   //paths run simultaneously
             <path> *stroke-width: 2*   //paths run simultaneously
             <path> *stroke-width: 1.5* //paths run simultaneously
       </g>
       <g id='LG2-3'> //group should runs sequentially, but paths within should run simultaneously
             <path> *stroke-width: 1*   //paths run simultaneously
             <path> *stroke-width: 18*  //paths run simultaneously
             <path> *stroke-width: 18*  //paths run simultaneously
             <path> *stroke-width: 1*   //paths run simultaneously
       </g>
</g>

<g id='Logo_Group3'>  //3rd pathObj
       <g id='LG3-1'> //group runs **simultaneously**, but with *delays* on paths within
             <path> *delay: 0*     //paths run simultaneously, with delay
             <path> *delay: 25*    //paths run simultaneously, with delay
             <path> *delay: 50*    //paths run simultaneously, with delay
             <path> *delay: 75*    //paths run simultaneously, with delay
       </g>
       <g id='LG3-2'> //group runs **simultaneously**, but with *delays* on paths within
             <path> *delay: 25*    //paths run simultaneously, with delay
             <path> *delay: 50*    //paths run simultaneously, with delay
             <path> *delay: 75*    //paths run simultaneously, with delay
             <path> *delay: 100*   //paths run simultaneously, with delay
       </g>
       <g id='LG3-3'> //group runs **simultaneously**, but with *delays* on paths within
             <path> *delay: 75*    //paths run simultaneously, with delay
             <path> *delay: 100*   //paths run simultaneously, with delay
             <path> *delay: 125*   //paths run simultaneously, with delay
             <path> *delay: 150*   //paths run simultaneously, with delay
       </g>
</g>

In its most raw form - what I need is something like :: "a path" animates, then "b path thru e path" animate simultaneously, then "f path" animates.

On either var pathObj1 completion or f path completion - I'd like to trigger var pathObj2 to begin animating the paths therein.

"var pathObj2" completion triggers "var pathObj3" , etc. etc.

Like below:

var pathObj1 = { 
    "LogoGroup1": { 
        "strokepath": [
          { 
                "path": "a path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': true**
          },
          {
                "path": "b path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
          },
          {
                "path": "c path",
                        'duration': 300,
                     'strokeWidth': 18,
                **'drawSequential': false**
          },
          {
                "path": "d path",
                        'duration': 300,
                     'strokeWidth': 18,
                **'drawSequential': false**
          },
          {
                "path": "e path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
          },
          {
                "path": "f path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': true**
                   ** 'onComplete': *pathObj2* **
          }
          ],
        "dimensions": {
            "width": 1024,
            "height": 779
        }
    }
}; 

var pathObj2 = { 
   "LogoGroup2": { 
      "strokepath": [
          { 
                "path": "a path",
                        'duration': 300,
                     'strokeWidth': 4,
                **'drawSequential': true**
          },
          {
                "path": "b path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': true**
          }
          ],
        "dimensions": {
            "width": 1024,
            "height": 779
        }
    }
}; 


var pathObj3 = { 
  "LogoGroup3": { 
     "strokepath": [
          { 
                "path": "a path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
                         **'delay': 25ms**
          },
          {
                "path": "b path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
                         **'delay': 50ms**
          },
          { 
                "path": "c path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
                         **'delay': 75ms**
          },
          {
                "path": "d path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
                         **'delay': 100ms**
          },
          { 
                "path": "e path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
                         **'delay': 125ms**
          },
          {
                "path": "f path",
                        'duration': 300,
                     'strokeWidth': 1,
                **'drawSequential': false**
                         **'delay': 150ms**
          }
          ],
        "dimensions": {
            "width": 1024,
            "height": 779
        }
    }
}; 

$(document).ready(function(){ 
     $('#Logo_Group1').lazylinepainter( 
     {
            'svgData': pathObjLG1,
         'onComplete': pathObjLG2

     }).lazylinepainter('paint'); 

     $('#Logo_Group2').lazylinepainter( 
     {
            'svgData': pathObjLG2,
         'onComplete': pathObjLG3

     }).lazylinepainter('paint'); 

     $('#Logo_Group3').lazylinepainter( 
     {
            'svgData': pathObjLG3,
         'onComplete': pathObjLG4

     }).lazylinepainter('paint'); 
});

Any Help is much appreciated. :)

Order animation

Hi,
I have 5 lines animates well, but how can I have a different animation order?
Did you have to use Illustrator in a certain way or we have a parameter, I didn't saw any parameter in the documentation?
Thanks

Please explain "overrideKey" attribute

Thanks for this great plugin. Could you please provide a better description and example of the "overrideKey" attribute. I can't make sense of "Set this property if you selector id doesn't match the key referencing your path data value within svgData".

adding color inside svg

Is there a way were I can add color inside the SVG. I was looking at the documentation hoping to finding something like "fill" to put color inside the SVG. Basically the concept is once the svg finishes animating it will add color inside.

Set viewbox attribute separate from width/height property for svg

When I set the width height property for the pathObj as below:

    var pathObj = {
        "icon-audience": {
            "strokepath": [
                {
                    "path": "M41.2 39.2c-2.4 0-4.3 1.9-4.3 4.3v45.699999999999996h76.1v-45.699999999999996c0-2.4-1.9-4.3-4.3-4.3h-67.5zM40.4 42.6h69.3v43.2h-69.3zM126.3 110.2l-13.2-21h-76.2l-13.2 21v1.7h102.6z",
                    "duration": 300
                },
                {
                    "path": "M80.9 62.2h21.9M80.9 66.2h21.9",
                    "duration": 300
                },
                {
                    "path": "M73.6 75.3M51.5 75.3",
                    "duration": 300
                },
                {
                    "path": "M50.9 74s1-1.2 3.4-1.7c4.1-.8 4.3-3.4 2.4-5.5M60.7 68.6c-3.2 0-5.8-3.1-5.8-6.9s2.6-6.9 5.8-6.9c3.2 0 5.8 3.1 5.8 6.9 0 1.9-.6 3.6-1.7 4.9l-.1.2c-1.8 2.1-1.7 4.6 2.4 5.5 2.4.5 3.4 1.7 3.4 1.7",
                    "duration": 300
                },
                {
                    "path": "M109.2 99.5h-68.4l3-6.8h62.4zM82.6 106.7h-15.4l.6-3.7h14.2zM42.3 96.1h65.4",
                    "duration": 300
                },
                {
                    "path": "M49 92.7l-2.3 7M54.2 92.7l-2 6.8M59.4 92.7l-1.7 6.8M64.6 92.7l-1.5 6.8M69.2 96.1l.6-3.4",
                    "duration": 300
                },
                {
                    "path": "M101 92.7l2.3 7M95.8 92.7l2 6.8M90.6 92.7l1.7 6.8M85.4 92.7l1.5 6.8M80.8 96l-.6-3.3",
                    "duration": 300
                }
            ],
            "dimensions": {
                "height": 350,
                "width": 350
            }
        }
    };

It makes the element viewport property '0 0 350 350' and my inline element width and height the same. I need these values to be different. Any help would be appreciated. Thanks!

Dots before draw on Safari and Firefox

Hi,

I have a problem and can't solve it yet. Dots appears before the animation...Does anyone knows how to solve this?
You can see it here: http://www.fevre-gaucher.com/dev/

On Chrome there is no problem, it's only on Firefox and Safari (may be on IE too but I can't check it)

Thanks very much and thanks for your work on this code

(anonymous function) issue

I don't get this issue when using older versions of lazy line painter (1.1) but I am thrown plenty of errors when attempting to use 1.7. Anonymous function is being thrown out in my own code:

 $(document).ready(function(){ 
       $('#line').lazylinepainter( // Issue on this line
  {
    "svgData": pathObj,
    "strokeWidth": 2,
    "strokeColor": "#000",
    'drawsequential': false,
    }).lazylinepainter('paint'); 
 });

Aswell as a whole bunch of errors in the actual path code and the lazy line painter 1.7 js code:

Error: Invalid value for <path> attribute d="M29.6,315. L 24.9,315.9 21.9,314.9 14.6,314.9 9,313.4 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M36.9,313. L 35.6,310.8 36.9,235.2 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M33.2,326. L 136.4,339 146.3,338.1 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M193.5,336. L 193.5,308.2 199.2,308.2 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M323.6,318. L 332.1,356.2 350.9,350.9 341.7,315.3 z"m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M-3,333. L 599.4,406.1 670.9,410.4 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M412.1,358. L 412.1,374.3 390.1,357.1 390.1,369.4 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M493.6,192. L 412.1,199 425.3,187.1 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M417.6,189. L 404.6,197 344,195.3 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M266.9,202. L 248.6,211.1 125.7,223.7 146.7,211.6 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.js:7975 Error: Invalid value for <path> attribute d="M261.8,166. L 261.8,152.4 245.9,154.5 245.8,158.9 250.1,158.7 250.1,163.8   241.8,164.7 241.8,155.7 241.1,155.8 "m.extend.attr @ jquery.js:7975m.access @ jquery.js:4171m.access @ jquery.js:4143m.fn.extend.attr @ jquery.js:7933_getPath @ jquery.lazylinepainter-1.7.0.js:580_setupPaths @ jquery.lazylinepainter-1.7.0.js:330(anonymous function) @ jquery.lazylinepainter-1.7.0.js:80m.extend.each @ jquery.js:384m.fn.m.each @ jquery.js:136methods.init @ jquery.lazylinepainter-1.7.0.js:66$.fn.lazylinepainter @ jquery.lazylinepainter-1.7.0.js:701(anonymous function) @ ?page_id=15:1025j @ jquery.js:3148k.fireWith @ jquery.js:3260m.extend.ready @ jquery.js:3472J @ jquery.js:3503
jquery.lazylinepainter-1.7.0.js:540 Uncaught TypeError: Cannot read property 'x' of undefined

The animation doesn't paint at all, but a blank space is reserved in the dom

Reverse not working since update

It appears that the 'reverse': true feature has stopped functioning since the 1.6.1 update... unless there is another required attribute on the individual path that I am unaware of. My LLP animation can be seen here - Codepen!.

Any help would be much appreciated.

Multiple animation in the same page

Hi! Nice plugin thank you but I have an issue because I have trigged animation after clicking buttons!!

In other words I have a page like:

Each button starts the animation of the next page, but I don't know why after added the second svg the first don't appear

Combining APIs? Erase, Paint, Play/Pause & Set? Possible?

Would that be possible?

Where the range input progressed from 0 to 1 as the animation unfolded... allowing a user to move the input range from 0 - 1 (just like the Set feature) but where, upon page load, it began animating either way.

Pressing the play/pause button would have the intuitive effect of stopping the [input range] and the animation itself at that point...

What'd you think?

Set width with a percent

Hello, congratulations, what a great work!

I want to ask if is there any possibility of set the width of the animation with a percent. I'm trying to put in dimensions something like "50%" but it does not work.

Thanks in advanced :)

Setting different colors to different paths

Hi, where do I change the color for each path. There is a "duration" element after each path, wondered if I put it right after that. Do I then have to delete the color element at the end that colors all the paths at once? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.