html5云层动画,基于webGL的云层动画js插件

这是一款基于webGL的云层动画js插件。该插件使用HTML5 canvas 和 WebGL API,生成可控制的多层云彩动画特效。

NPM安装

npm install klouds --save

使用方法

ES6语法:

import * as klouds from 'klouds'

在页面中引入下面的文件。

HTML结构

初始化插件

// vanilla javascript

klouds.create({

selector: '#myClouds'

});

// jQuery plugin

$(function(){

$('#myClouds').Klouds();

});

API

const instance = $('#myClouds').Klouds();

// start the animation

instance.start()

// stop the animation

instance.stop()

// get the current animation speed

instance.getSpeed()

// set the animation speed

instance.setSpeed(speed)

// get the number of cloud layers

instance.getLayerCount()

// set the number of cloud layers

instance.setLayerCount(count)

// get the background color

instance.getBgColor()

// set the background color

instance.setBgColor(color)

// get the color 1

instance.getCloudColor1()

// set the color 1

instance.setCloudColor1(color)

// get the color 2

instance.getCloudColor2()

// set the color 2

instance.setCloudColor2(color)

示例代码

var clouds = klouds.create({

selector: '#my-cloud-canvas',

speed: 5,

layerCount: 7,

bgColor: 'white',

cloudColor1: 'white',

cloudColor2: 'red'

})

// later you could for example changed the speed

clouds.setSpeed(10)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值