jQuery插件ImageDrawer.js實現(xiàn)動態(tài)繪制圖片動畫(附源碼下載)
ImageDrawer.js是一款可以實現(xiàn)動態(tài)繪制圖片動畫的jQuery插件。通過ImageDrawer.js插件,你可以制作在頁面中繪制圖片的動態(tài)過程,你可以控制繪制動畫的持續(xù)時間等參數(shù),非常有趣。
使用方法
使用該動態(tài)繪制圖片插件需要在頁面中引入imagedrawer.css,jquery和imagedrawer.js文件。
<link rel="stylesheet" href="css/imagedrawer.css" type="text/css"/> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/imagedrawer.js"></script>
HTML結構
在頁面中插入你需要繪制的圖片。
<div id="container"> <img id="example" src="img.jpg"> </div>
初始化插件
在頁面DOM元素加載完畢之后,可以通過下面的方法來初始化該圖片繪制插件。
$('div#container').drawImage();
配置參數(shù)
ImageDrawer.js圖片繪制插件有以下一些可用的配置參數(shù)。
$(div#container).drawImge({ duration: 20, @number - seconds it's take to draw the entire picture Instead of specifying the duration on the whole animation, || { it's also possible to set the duration of single drawing phases: borderPencil : 9, @number - seconds it's take to draw the picture by using only the pencil for borders pencilShades : 6, @number - seconds it's take to draw sharpest shades with black pencil colorShades : 7.5, @number - seconds it's take to draw first, basic, vanish colors fullColors : 7.5 @number - seconds it's take to define better all colors on the picture }, background: '#949494', @string - background color for image while it's been drawing callback: fn(), @function - function to execute after the last phase pencil: { height: '50px', width : '50px', src : './img/pencil.png' @string - path to the pencil image } });
duration:繪制動畫的持續(xù)時間??梢允且粋€整數(shù),或是一個對象:
{ borderPencil : 9, pencilShades : 6, colorShades : 7.5, fullColors : 7.5 }
borderPencil:繪制邊框需要的時間。
pencilShades:繪制黑白陰影部分需要的時間。
colorShades:繪制彩色陰影需要的時間。
fullColors;填充顏色需要的時間。
background:畫布的背景顏色。
callback:回調函數(shù)。
pencil:在畫布上方顯示的鉛筆小圖標。
以上所述是小編給大家介紹的jQuery插件ImageDrawer.js實現(xiàn)動態(tài)繪制圖片動畫(附源碼下載)的相關知識,希望對大家有所幫助!
相關文章
jQuery滑動到底部加載下一頁數(shù)據(jù)的實例代碼
這篇文章主要介紹了jQuery滑動到底部加載下一頁數(shù)據(jù)的實例代碼,需要的朋友可以參考下2017-05-05jQuery源碼解讀之extend()與工具方法、實例方法詳解
這篇文章主要介紹了jQuery源碼解讀之extend()與工具方法、實例方法,分析了jQuery中extend()源碼、功能與相關使用技巧,需要的朋友可以參考下2017-03-03javascript的變量、傳值、傳址、參數(shù)之間關系
這篇文章主要介紹了javascript的變量、傳值、傳址、參數(shù)之間關系的相關資料,需要的朋友可以參考下2015-07-07jQuery中table數(shù)據(jù)的值拷貝和拆分
在開發(fā)的過程中,經常會遇到彈出框顯示前一頁table列表的情況,這時候會有好多方法來來解決。下面小編給大家介紹怎么用jquery將值拷貝到第二頁并拆分拷貝的值,需要的朋友參考下2017-03-03EasyUi tabs的高度與寬度根據(jù)IE窗口的變化自適應代碼
EasyUi tabs的高度與寬度根據(jù)IE窗口的變化自適應代碼,需要的朋友可以參考下。2010-10-10