UNPKG

1.66 kBMarkdownView Raw
1# Flickity Transformer
2*Transform your Flickity*
3
4Flickity Transformer enhances [Flickity](http://flickity.metafizzy.co/) with exciting effects through the use of CSS transform functions.
5
6- [Installation](#installation)
7- [Usage](#usage)
8- [Examples](#examples)
9- [Contributing](#contributing)
10
11## Installation
12Via NPM:
13
14```bash
15npm i --save flickity-transformer
16```
17
18## Usage
19```js
20var Flickity = require('flickity')
21var FlickityTransformer = require('flickity-transformer')
22
23var flckty = new Flickity('.carousel', {
24 // options
25})
26
27// Create a new instance of FlickityTransformer, passing in your `flckty` instance and a configuration object that contains an array of `transforms`. Each transform should have a `name` property, corresponding to the transform function you want to use, and a `stops` array, containing at least two stops. Each stop is an array with two values: x position in pixels relative to the home position of your carousel, and the transform value to apply at that position.
28var ftx = new FlickityTransformer(flckty, {
29 transforms: [
30 {
31 name: 'scale',
32 stops: [
33 [-300, 0.5],
34 [0, 1],
35 [300, 0.5]
36 ]
37 },
38 {
39 name: 'rotate',
40 stops: [
41 [-300, -45],
42 [0, 0],
43 [300, 45]
44 ]
45 }
46 ]
47})
48
49## Examples
50Coming soon...
51
52## Contributing
53Contributions are welcome.
54
55### TODO
56
57- Add support for more transform functions.
58- Add ability to use units other than the defaults.
59- Replace d3-scale dependency with a lighter-weight linear scale that supports clamping and piecewise scales.
60- Test against all Flickity features (e.g. wrapAround is not currently supported).
61
\No newline at end of file