当前位置:网站首页>h5实现一个刮刮卡的动画效果
h5实现一个刮刮卡的动画效果
2022-07-19 09:38:00 【InfoQ】
前言
需求
wScratchPad.js
实现过程
wScratchPad.js
wScratchPad.js
wScratchPad.js
wScratchPad.js
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script type="text/javascript" src="./wScratchPad.js"></script>
<style>
#box{
width: 600px;
height: 600px;
}
</style>
<div id="box"></div>
<script>
$('#box').wScratchPad({
size: 50,
bg: './food.png',
fg: '#ccc',
realtime: true,
scratchDown: null,
scratchUp: function(e, percent){
percent > 50? $('#box').wScratchPad('clear') : '' // 当刮出区域大于百分之五十,就将底图全部展示
},
scratchMove: null,
cursor: 'crosshair',
});
function clear(){
}
</script>
scratchUp
scratchMove

wScratchPad.js官方地址
wScratchPad.js
后记
边栏推荐
- 12. Talk about the implementation principle of single sign on in the project?
- Failed to process package ‘cartographer_ros‘ :
- C leetcode question brushing notes 3- Count the number of items matching the search rule
- WIN11安装visual studio2019出现“无法下载安装文件,请检查Internet连接,然后重试”
- How to deal with repeated consumption of MySQL data read by Flink
- PyG教程(8):计算更高效的稀疏矩阵形式
- 【Kingbase】数据类型格式化函数
- Impala of CDH
- Unity practical problems webgl problem collection part 2
- Outils de construction
猜你喜欢
Mysql 主从配置
12. Talk about the implementation principle of single sign on in the project?
Panda3D绘制立方体
.NET 7 新增速率限制 (Rate Limiting) 功能,轻松限制请求数量
How can I use coreldrawx8 for free when the trial expires? cdrX8
MongoDB 安全认证
QIODevice
Use onedns to perfectly solve the optimization problem of office network
开发那些事儿:Go与C类型转换出现内存泄漏该如何解决?
动态内存管理
随机推荐
Use of Evo assessment tools
"Unable to download the installation file, please check your Internet connection and try again" appears when installing visual studio2019 in win11
Develop those things: how to solve the memory leak in the conversion between go and C type?
. Net 7 adds the rate limiting function to easily limit the number of requests
Panda3D get mouse position, Panda3D Task Manager
I'd like to ask you something. I'm in Zhuhai now. Where is a better place to open an account? Is it safe to open a stock account by mobile phone?
Automatic pixel-level multipledamagedetectionofconcrete structure using fullyconvolutionalnetwork-笔记
Mongodb security authentication
Write "Hello, china." for domestic smart watches with C #
Browser debugging
Reading the paper: retreating atmosphere revolution for semantic image segmentation
Sending the email to the following server failed. IOException while sending message problem solving
Nacos configuration management - unified configuration management
[Kingbase] data type formatting function
Nacos配置管理——配置共享
Paper reading: linknet: expanding encoder representations foreefficient semantic segmentation
pytorch3D参考教程
一汽红旗“王炸”上市,安全、舒适一个不落
postgresql 两个月份,如何计算一共有几个月?
Panda3D绘制立方体