-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
149 lines (127 loc) · 4.76 KB
/
Copy pathindex.html
File metadata and controls
149 lines (127 loc) · 4.76 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chai - AryCodes</title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
background-color: #f4f4f4;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.container {
height: 100%;
width: 100%;
justify-content: center;
display: flex;
flex-direction: column;
}
.teaglass {
height: 30%;
aspect-ratio: 1/1;
border: 2px solid #333;
display: flex;
justify-content: flex-end;
flex-direction: column;
position: absolute;
cursor: grab;
background-color: #d3d3d3;
clip-path: polygon(0 0, 100% 0, 83% 100%, 17% 100%);
overflow: hidden;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
}
.tea {
background: linear-gradient(to bottom, #c18244, #c18244, #8f5720);
width: 100%;
clip-path: polygon(0 0, 100% 0, 83% 100%, 17% 100%);
transition: height 0.3s ease;
}
img.unselectable {
user-select: none;
max-width: 100%;
height: auto;
}
h1 {
text-align: center;
color: #333;
margin-bottom: 20px;
margin-top: -400px;
}
p {
text-align: center;
color: #666;
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="container">
<h1>Have A Chai With AryCodes</h1>
<p>Click and drag the teaglass to enjoy a virtual cup of tea!</p>
<div class="teaglass" id="teaglass" onmousedown="startDrag(event)">
<img src="s.svg" alt="" class="unselectable">
<div class="tea" id="tea"></div>
</div>
</div>
<script>
let isDragging = false;
let offsetX = 0;
const teaglass = document.getElementById('teaglass');
const teaDiv = document.getElementById('tea');
teaglass.addEventListener('mousedown', startDrag);
teaglass.addEventListener('touchstart', startDrag);
document.addEventListener('mousemove', drag);
document.addEventListener('touchmove', touchDrag);
document.addEventListener('mouseup', stopDrag);
document.addEventListener('touchend', stopDrag);
function startDrag(e) {
e.preventDefault();
isDragging = true;
teaglass.style.transition = 'none';
// Check if the event is a touch event
const clientX = e.type === 'touchstart' ? e.touches[0].clientX : e.clientX;
offsetX = clientX - teaglass.getBoundingClientRect().left;
}
function drag(e) {
if (!isDragging) return;
const maxX = window.innerWidth - teaglass.offsetWidth;
let newX = e.clientX - offsetX;
newX = Math.min(newX, maxX);
newX = Math.max(newX, 0);
teaglass.style.left = `${newX}px`;
const percentage = (newX / maxX) * 100;
teaDiv.style.height = `${percentage}%`;
}
function touchDrag(e) {
if (!isDragging) return;
const maxX = window.innerWidth - teaglass.offsetWidth;
let newX = e.touches[0].clientX - offsetX;
newX = Math.min(newX, maxX);
newX = Math.max(newX, 0);
teaglass.style.left = `${newX}px`;
const percentage = (newX / maxX) * 100;
teaDiv.style.height = `${percentage}%`;
}
function stopDrag() {
isDragging = false;
teaglass.style.transition = 'all 0.3s ease';
}
</script>
<a id="floating-button" href="https://www.instagram.com/arycodes" target="_blank"
style="position:fixed;bottom:20px;right:20px;background-color:#fff;color:#000;border:none;border-radius:50%;padding:15px;cursor:pointer;box-shadow:0 4px 8px rgba(0,0,0,0.2);transition:background-color 0.3s ease,transform 0.3s ease;display:flex;align-items:center;justify-content:center;text-decoration:none;transform-style:preserve-3d;perspective:1000px;">
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js"></script>
<i class="fab fa-instagram" style="font-size:24px;transform:rotateY(0deg);transition:transform 0.3s ease;"></i>
</a>
</body>
</html>