This time I will share jQuery Plugin and tutorial about Create Animated Clouds Using Canvas And WebGl – klouds.js, hope it will help you in programming stack.
klouds.js is a jQuery & Vanilla JavaScript plugin to generate animated, customizable clouds using HTML5 canvas and WebGL API.
Great for generating a graceful sky background for your web app.
How to use it:
1. Install & download the plugin.
2 |
$ npm install klouds --save |
2. Import & load the klouds.js in the document.
2 |
import * as klouds from 'klouds' |
2 |
< script src = "lib/klouds.min.js" ></ script > |
5 |
< script src = "/path/to/cdn/jquery.min.js" ></ script > |
6 |
< script src = "lib/klouds.min.js" ></ script > |
3. Create a canvas element on which the plugin renders the animated clouds.
1 |
< canvas id = "myClouds" ></ canvas > |
4. Call the function on the canvas element and done.
8 |
$( '#myClouds' ).Klouds(); |
5. Set the animation speed. Default: 1. Support negative numbers.
1 |
$( '#myClouds' ).Klouds({ |
6. Specify the umber of cloud paralax layers. Default: 5.
1 |
$( '#myClouds' ).Klouds({ |
7. Customize the cloud colors.
1 |
$( '#myClouds' ).Klouds({ |
2 |
cloudColor1: [25, 178, 204], |
3 |
cloudColor2: [255, 255, 255] |
8. Customize the background color of the sky.
1 |
$( '#myClouds' ).Klouds({ |
2 |
cloudColor1: [25, 178, 204], |
3 |
cloudColor2: [255, 255, 255] |
9. Available API methods.
01 |
const instance = $( '#myClouds' ).Klouds(); |
13 |
instance.setSpeed(speed) |
16 |
instance.getLayerCount() |
19 |
instance.setLayerCount(count) |
25 |
instance.setBgColor(color) |
28 |
instance.getCloudColor1() |
31 |
instance.setCloudColor1(color) |
34 |
instance.getCloudColor2() |
37 |
instance.setCloudColor2(color) |
Changelog:
2021-01-09