Giter VIP home page Giter VIP logo

imagesflashingplugin's Introduction

ImagesFlashingPlugin

Pure JS Plugin for Images

ImagesFlashingPlugin

All usage recommendations you can also find directly in index.html file

๐Ÿ’ช Get Started

  • Connect flashing_v1.2/flashing.css file to the <head> section of your page. It's an optional step, but you can easily rewrite this styles or connect your own styles for flashing elements. But connecting flashing.css file is the best way to make your animation to looks perfect

Css connecting

  • Connect flashing_v1.2/execute.js file before </body> closing tag

Script connecting

  • To define the execution container (it can be more than one) create a block element and add class flashing to it. Next step is adding special settings attributes (If you forgot (or didn't want) to set your own settings, animation will start working with default settings)

    • data-theme: sets the color setting for all images that animation includes. Default: data-theme='color'
      1. color: all images has no filters
      2. greyscale: all images becomes greyscale
      3. sepia: all images has sepia filter
    • data-order: sets the order of elements output. Default: data-order='orderly'
      1. orderly: every lap of animation we will see images pausing from first to last and again
      2. random: sets random order and repeat this order on each lap
      3. absolute: means 'absolutly random' order. Images output order will be different every lap
    • data-speed: sets speed of quick images switching before pausing. Default: 1.5 (150ms). Can't be less than 0
    • data-duration: sets duration of each animation stage. Default: 2 (2s). It's the common value for both: quick switching time and pause time. The best practice to create the pure animation without any defects is to set speed and duration values equivalen, as an example 1.2 and 2.4
  • To define animated elements you should to add the elements with class flashing-image to execution container. The best way to do this (plugin styled for this) is to create block/flex (flex as a default) elements and add images directly inside this elements. You are also able to add any other tags inside this elements, it may be image's number as an example.

  • To add the animation to any element, you should to create block element inside selected by yourself flashing-image block and add him class flashing-animation. This block should contain two special attributes with image's url and sprites amount, but if you forgot (or didn't want) to add this attributes, it will be setted by default

    • data-src: contains the image's full or relative url. Default: data-src='sprites-circles.png'
    • data-amount: contains the number of sprites in animation. Default: data-amount='8'

Layout

  • How to make a right spritelist? Spritelist is a wide image, conditionally parted on the sectors with equal width. Each sector contains the stage of animation. For better understading spritelists, check the structure of the sprites-circles.png or sprites-squares.png file in the root path of this repository

๐Ÿ”ง How it works

  1. Script finds all flashing containers
  2. In each of this containers it defines the animated elements
  3. Than it sets parametres of the animation (as speed, theme, duration, animation, etc.)
  4. Next step is a setting start condition, that makes all elements, besides first, invisible
  5. If selected order is orderly โ€” script will be filled by default order array from first to last elements indexes 5.1. If selected order is random or absolute โ€” script will be filled by random order array with elements indexes in random order. For the random order this array will be used every next lap. For the absolute order this array will be used only for the first animation lap, and than this array will become useless, instead of it new array will be filled again every next lap
  6. Every step, setted by duration attribute's value, function called swithing will be started and paused, providing main execution function to show next element in queue. switching in this context means that elements will be shown and hidden from first to last for all duration time with speed, setted in data-speed attribute

๐Ÿ’ซ Usage Examples

The best usage example of this plugin it's a representation of company/project staff or just interesting animated gallery

๐Ÿ‘ DEMO

The main feature of this plugin is simple pure js code, without need of using jQuery or any other libraries or frameworks. You can easily customize it for your own needs. You can see the DEMO following the link: ImagesFlashingPlugin | DEMO

Demo preview

imagesflashingplugin's People

Watchers

James Cloos avatar Anton Miazyn 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.