-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtouchheart.html
More file actions
76 lines (71 loc) · 2.8 KB
/
touchheart.html
File metadata and controls
76 lines (71 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable"/>
<meta content="black" name="apple-mobile-web-app-status-bar-style"/>
<meta content="telephone=no" name="format-detection"/>
<meta content="email=no" name="format-detection"/>
<title>乌鸦出品 触动心跳 你不触摸它 它就萎缩了</title>
<script>
var i=1;
window.addEventListener('touchstart', function (e) {
var touchobj = e.changedTouches[0] // reference first touch point (ie: first finger)
startx = parseInt(touchobj.clientX) // get x position of touch point relative to left edge of browser
starty = parseInt(touchobj.clientY) // get x position of touch point relative to left edge of browser
//statusdiv.innerHTML = 'Status: touchstart<br /> ClientX: ' + startx + 'px'
i+=0.05;
e.preventDefault()
}, false);
window.addEventListener('touchmove', function (e) {
var touchobj = e.changedTouches[0] // reference first touch point for
e.preventDefault()
}, false);
window.addEventListener('touchend', function (e) {
var touchobj = e.changedTouches[0] // reference first touch point for this event
//statusdiv.innerHTML = 'Status: touchend<br /> Resting x coordinate: ' + touchobj.clientX + 'px'
var distX = parseInt(touchobj.clientX) - startx;
var distY = parseInt(touchobj.clientY) - starty;
e.preventDefault()
}, false);
setInterval(function(){
if(i<0){
document.getElementsByClassName("heart")[0].style.color="#000";
document.getElementsByClassName("heart")[1].style.color="#000";
}else{
document.getElementsByClassName("heart")[0].style.color="#f00";
document.getElementsByClassName("heart")[1].style.color="#f00";
}
document.getElementsByClassName("heart")[0].style.WebkitTransform="scale("+i+")";
document.getElementsByClassName("heart")[1].style.WebkitTransform="scale("+i+")";
i-=0.009;
},1000/24);
</script>
<style>
*{
margin:0px;
padding:0px;
}
@-webkit-keyframes pound {
30% { -webkit-transform: scale(2); }
}
@-webkit-keyframes rotate {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
.heart {
display: inline-block;
margin: 20% auto;
font-size: 80px;
color: #e00;
-webkit-transform-origin: center;
}
body { text-align: center; }
</style>
</head>
<body>
<div class="heart">♥</div>
<div class="heart">♥</div>
</body>
</html>