Code Monkey home page Code Monkey logo

pixi-carousel's Introduction

pixi-carousel

A canvas based image slider (carousel), with simple indicators and ability to zoom in/out.

Demo

Here

Usage

Install

bower install pixi-carousel

Include

<script src="bower_components/pixi/bin/pixi.min.js"></script>
<script src="bower_components/hammerjs/hammer.min.js"></script>
<script src="bower_components/pixi-carousel/dist/pixi-carousel.min.js"></script>

Begin Slide

var sliderEl = document.getElementById('slider');
var slideMgr = new SlideManager(500, 500, {// width and height of the manager (not images)
  view: sliderEl, // mandatory, your canvas element
  bkg_color: 0xF2EFE1, // default 0x000000, the background color
  is_accelerated: true, // default false, turn it on to enable the gradual change on sliding speed
  slide_percent_y: 0.5, // default 0.5, vertical position of slide
  has_indicators: true, // default true
  indicator_percent_y: 0.95,
  indicator_color: 0x000000, indicator_color_active: 0x000000,
  indicator_fillAlpha: 0.2, indicator_fillAlpha_active: 0.8,
});
var imgs = [
  'assets/img/drip-871152_640.jpg',
  'assets/img/blur-21653_640.jpg',
  'assets/img/lotus-854919_640.jpg'
];
slideMgr.setSlidesAndStart(imgs, {width: 640, height: 426});   // aspect ratio should be same as image file
slideMgr.startAutoSlide(2000);
slideMgr.enableSwipe();
slideMgr.enableZoom();

Dependencies

pixi.js, Hammer.js

pixi-carousel's People

Contributors

zopelee avatar

Watchers

James Cloos avatar Yehua avatar

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.