SongHb的gravatar头像
SongHb 2014-08-28 13:53:39

jquery实现微信刮刮乐特效源代码下载

wScratchPad是jQuery上的一个插件,它能模拟出刮的行为,使你能“擦去”一层覆盖物,这层覆盖物既可是一个图片,也可以是某种颜色涂层。

官方网址为 http://wscratchpad.websanova.com/

配置选项:

$('#elem').wScratchPad({
  size        : 5,          // The size of the brush/scratch.
  bg          : '#cacaca',  // Background (image path or hex color).
  fg          : '#6699ff',  // Foreground (image path or hex color).
  realtime    : true,       // Calculates percentage in realitime.
  scratchDown : null,       // Set scratchDown callback.
  scratchUp   : null,       // Set scratchUp callback.
  scratchMove : null,       // Set scratcMove callback.
  cursor      : 'crosshair' // Set cursor.
});

示例

包含头文件:

<script type="text/javascript" src="./wScratchPad.min.js"></script>

Percent scratched

$("#elem").wScratchPad({
  scratchDown: function(e, percent){ console.log(percent); },
  scratchMove: function(e, percent){ console.log(percent); },
  scratchUp: function(e, percent){ console.log(percent); }
});

Update on the Fly

var sp = $("#elem").wScratchPad();

sp.wScratchPad('size', 5);
sp.wScratchPad('cursor', 'url("./cursors/coin.png") 5 5, default');

// Or directly with element.
$("#elem").wScratchPad('image', './images/winner.png');

Methods

$('#elem').wScratchPad('reset');
$('#elem').wScratchPad('clear');
$('#elem').wScratchPad('enabled', <boolean>);

有图有真相

这是demo

jquery实现微信刮刮乐特效源代码下载

配合其他图片

jquery实现微信刮刮乐特效源代码下载


打赏

文件名:微信刮刮乐源码.rar,文件大小:297.809K 下载
  • /
      • /cursors
        • /cursors/Thumbs.db
        • /cursors/bird.png
        • /cursors/coin.png
        • /cursors/god-sword.png
        • /cursors/leaf.png
        • /cursors/mario.png
      • /images
        • /images/scratch-to-win.png
        • /images/slide1.jpg
        • /images/slide2.jpg
        • /images/slide3.jpg
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友