0.0.8 • Published 7 years ago

ani-clipath v0.0.8

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Install

CDN

<script src="https://unpkg.com/ani-clipath/dist/ani-clipath.min.js">

NPM

npm install --save ani-clipath

Usage

Need a container with width and height

<style>
  .shapes{
    width: 800px;
    height: 600px;
  }
</style>
...
<div class="shapes"></div>

Props

PropertytypeDescriptiondefault
elStringDOM containerempty
speedNumberAnimation speed of each triangle1500
delayNumberAnimation delay of each triangle30
autoplayNumberPlay automaticallytrue
autoplayIntervalNumberIntervals of autoplay5000
shapesArrayData of shapesArray

Methods

MethodDescription
next()Switch to next shape
previous()Switch to previous shape
<script>
  var aniClipath = new AniClipath({
    el: '.shapes',
    speed: 1000,
    delay: 30,
    autoplay: true,
    autoplayInterval: 5000,
    shapes: data
  })
  setInterval(function(){
    aniClipath.next()
  },3000)
</script>

Data format of shapes

var data = [
  [
    // item of shapes
    { 
      // color of item
      c: '#1A1A1A',
      // polygon position of item
      p: [ { x: '50%', y: '30%' }, { x: '30%', y: '70%' }, { x: '70%', y: '70%' }]
    }
  ],
  [
    {
      c: '#E6E6E6',
      p: [ { x: '50%', y: '70%' }, { x: '30%', y: '30%' }, { x: '70%', y: '30%' }]
    }
  ]
]

License

MIT

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago