Giter Site home page Giter Site logo

landsurveyorsunited / ken-burns-carousel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from festify/ken-burns-carousel

0.0 1.0 0.0 68 KB

๐ŸŒ„ A web component that displays a set of images with a ken burns effect

Home Page: https://festify.github.io/ken-burns-carousel/

License: MIT License

TypeScript 93.94% JavaScript 6.06%

ken-burns-carousel's Introduction

<ken-burns-carousel>

Travis

A bare and extremely light web component that displays a set of images with a ken burns effect. Demo.

Usage

Import the JS:

/*
 * Importing directly from the element defines the element class
 * and registers it with the global element registry with the tag
 * name 'ken-burns-carousel'.
 */
import 'ken-burns-carousel';

Alternatively:

/*
 * In case the default name conflicts, you can import from
 * 'ken-burns-element/dist/element'. This export _does not_ register
 * the element with the element registry and allows you to choose
 * a custom tag name.
 */
import KenBurnsElement from 'ken-burns-carousel/dist/element';

customElements.define('custom-ken-burns-element-tag', KenBurnsElement);

Use the element in the DOM:

<!-- Set images to display via attribute (property is also supported) -->
<ken-burns-carousel images="https://source.unsplash.com/Qh9Swf_8DyA https://source.unsplash.com/O453M2Liufs">
</ken-burns-carousel>

And the carousel will begin fading images โœจ. See the Demo for more examples.

Compatibility

The element works in all evergreen browsers (tested on Firefox, Chrome, Safari and Edge). Mileage with other browsers may vary.

That said, the element does not do any complex DOM operations or use any fancy APIs (except for web components, of course), so adapting it, if needed, will be simple. The element has been adapted for usage with the ShadyDOM polyfill.

Performance

The element makes careful use of composition layers and uses CSS 3D transforms and opacity animations exclusively. As such, animations will run butter smooth even when expensive filters are applied to the images.

The element also preloads images before displaying them so that FOUCs are prevented. This also works across different image lists. For optimal results, ensure the element has a nice background color as the element is transparent while the first image is loading.

License

MIT

ken-burns-carousel's People

Contributors

neolegends avatar leolabs avatar

Watchers

James Cloos 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.