Generate Animated SVG Lines With jQuery - ckLine.js

File Size: 16.8 KB
Views Total: 4718
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Generate Animated SVG Lines With jQuery - ckLine.js

ckLine.js is a funny jQuery plugin for generating random customizable SVG lines with fade in & fade out animations on the web page.

How to use it:

1. Load the latest version of jQuery library and the jQuery ckLine.js plugin in the html document.

<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="jquery.ckLine.js"></script>

2. Create an empty SVG element on the web page.

<svg id="ckLine" xmlns="http://www.w3.org/2000/svg">
</svg>

3. Call the function on the SVG element to generate default lines on the web page.

$('#ckLine').ckLine();

4. Customize the SVG lines with the following options.

$('#ckLine').ckLine({

  // SVG ID
  svgId: null,

  // stroke coor
  strokeColor: "#000",

  // stroke width
  strokeWidth: 2,

  // animation speed
  animateTime: 1000,

  // interval
  interval: 600,

  // time before fade out
  fadeOutTime: 800,

  // duration
  lifeTime: 2000,

  // width/heigh of the svg
  width: viewportwidth,
  height: viewportHeight,

  // only horizontal lines
  leftRight: true,

  // easing function
  easing: 'swing',

  // an array of time ranges
  animationTimeRange: []
  
});

Change log:

2017-12-12

  • Fix Firefox Bug

This awesome jQuery plugin is developed by captainKeller. For more Advanced Usages, please check the demo page or visit the official website.