npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

flickity-transformer

v0.3.6

Published

Transform your Flickity

Downloads

1,871

Readme

Flickity Transformer

An interface for declaring granular transform effects for Flickity.

Demo image

Installation

Via NPM:

yarn add flickity-transformer
# or
npm i --save flickity-transformer

Via download:

CDN:

<!-- Minified -->
<script src="https://unpkg.com/flickity-transformer/dist/flickity-transformer.pkgd.min.js"></script>

<!-- Un-minified -->
<script src="https://unpkg.com/flickity-transformer/dist/flickity-transformer.pkgd.js"></script>

Usage

Create a new FlickityTransformer, passing in your Flickity instance and an array of transform objects. Transforms will be applied to each Flickity cell in the order they are declared.

var Flickity = require('flickity')
var FlickityTransformer = require('flickity-transformer')

var flkty = new Flickity('.carousel', {
  // options
})

var transformer = new FlickityTransformer(flkty, [
  {
    name: 'scale', // Let's scale your cells...
    stops: [
      [-300, 0.5], // at -300px, slides will be scaled to 0.5
      [0, 1], // at the home position, slides will be full size
      [300, 0.5] // at 300px, slides will be half size again
    ]
  },
  {
    name: 'rotate', // and add a little rotation...
    unit: 'rad' // use a unit other than the default
    stops: [
      [-300, -1], // rotate slides to the left by 1 radian
      [0, 0], // they'll be straight at center
      [300, 1] // and rotated to the right
      // Add as many stops as you need
    ]
  }
])

Transforms

Each object in the transforms array requires at least two properties: name and stops. Each stop in stops 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.

| property | type | value | | ------------- | --------- | ----------------- | | name | String | (required) The transform function name | stops | Array | (required) An array of at least two transform stops. | | unit | String | (optional) Override the default unit. |

// Example: rotate cells between -1rad at -300px, and 1rad at 300px:
{
  name: 'rotate',
  unit: 'rad',
  stops: [
    [-300, -1],
    [300, 1]
  ]
}

Default units

const units = {
  perspective: 'px',
  rotate: 'deg',
  rotateX: 'deg',
  rotateY: 'deg',
  rotateZ: 'deg',
  skew: 'deg',
  skewX: 'deg',
  skewY: 'deg',
  translateX: 'px',
  translateY: 'px',
  translateZ: 'px'
}

Examples

Contributing

Contributions are welcome. Top priorities are to support wrapAround: true and units other than pixels for stop positions. See issues for details. To get up and running:

# Install dependencies
$ npm install

# Lint, test & build
$ npm run build

# Run functional test in the browser
$ npm run functional

# See various scripts in package.json

Uses JavaScript Standard Style.