jQuery Plugin To Animate Background Images - jwtextureswim

jQuery Plugin To Animate Background Images - jwtextureswim
File Size: 694 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

jwtextureswim is a jQuery plugin for creating animated backgrounds that allows you to animate the x and y positions of an element's background image. It helps to have a seamless repeating background image for any container.

How to use it:

1. Load the jQuery jwtextureswim plugin after jQuery library but before the closing body tag.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="jwtextureswim-1.0.js"></script>

2. Add a background image to your container.

.demo {
  ...
  background-image: url(bg.png);
  ...
}

3. Animate the background image.

$(".demo").textureSwim(/*OPTIONS*/);

4. Override the default animation options of the background image.

// Number of pixels the texture will swim (horizontally) in one cycle. 
// Note: Pass a negative number to go left.
distanceX : 500,

// Number of pixels the texture will swim (vertically) in one cycle. 
// Note: Pass a negative number to go up.
distanceY : 0,

// The time delay after each animation is complete.
delay : 0,
delayAfter : 0,

// The amount of time it will take the texture to move "distance" pixels. 
duration : 5000,

// The easing function to use to animate. 
ease : "linear", 

// Number of times the function should repeat. 
repeat : -1,

// Whether or not to stop the swim. 
// Note: You can also just call .stop();
stop: false

This awesome jQuery plugin is developed by jworksstudios. For more Advanced Usages, please check the demo page or visit the official website.