图片/图形

ImageDrawer 动态绘制图片动画jQuery插件

阿里云


ImageDrawer.js 是一款可以实现动态绘制图片动画的 jQuery 插件。通过 ImageDrawer.js 插件,你可以制作在页面中绘制图片的动态过程,你可以控制绘制动画的持续时间等参数,非常有趣。

使用方法

使用该动态绘制图片插件需要在页面中引入 imagedrawer.css,jquery 和 imagedrawer.js 文件。

也想出现在这里?联系我们
创客主机
  1. <link rel="stylesheet" href="css/imagedrawer.css" type="text/css"/>
  2. <script type="text/javascript" src="js/jquery.min.js"></script>
  3. <script type="text/javascript" src="js/imagedrawer.js"></script>

HTML 结构

在页面中插入你需要绘制的图片。

  1. <div id="container">
  2.   <img id="example" src="img.jpg">
  3. </div>

初始化插件

在页面 DOM 元素加载完毕之后,可以通过下面的方法来初始化该图片绘制插件。

  1. $('div#container').drawImage();

配置参数

ImageDrawer.js 图片绘制插件有以下一些可用的配置参数。

  1. $(div#container).drawImge({
  2.    duration: 20,              @number - seconds it's take to draw the entire picture
  3.  
  4.                               Instead of specifying the duration on the whole animation,
  5.    || {                       it's also possible to set the duration of single drawing phases:
  6.      borderPencil : 9,     @number - seconds it's take to draw the picture by using only the pencil for borders
  7.      pencilShades : 6,    @number - seconds it's take to draw sharpest shades with black pencil
  8.      colorShades  : 7.5,  @number - seconds it's take to draw first, basic, vanish colors
  9.      fullColors   : 7.5      @number - seconds it's take to define better all colors on the picture
  10.    },
  11.  
  12.    background: '#949494',     @string   - background color for image while it's been drawing
  13.    callback: fn(),            @function - function to execute after the last phase
  14.    pencil: {
  15.       height: '50px',
  16.         width : '50px',
  17.         src   : './img/pencil.png'    @string - path to the pencil image
  18.     }
  19.  });

duration:绘制动画的持续时间。可以是一个整数,或是一个对象:

  1. {
  2.       borderPencil : 9,  
  3.       pencilShades : 6,  
  4.       colorShades  : 7.5, 
  5.       fullColors   : 7.5 
  6.     }
  7.     }

borderPencil:绘制边框需要的时间

pencilShades:绘制黑白阴影部分需要的时间

colorShades:绘制彩色阴影需要的时间

fullColors;填充颜色需要的时间

background:画布的背景颜色

callback:回调函数

pencil:在画布上方显示的铅笔小图标
Github 地址:https://github.com/UstymUkhman/ImageDrawer.js

ImageDrawer 动态绘制图片动画 jQuery 插件

已有 290 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!