250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- SWIFT
- effect
- 애니메이션
- html5
- jQuery
- hover
- react
- 프론트엔드
- IOS
- Animation
- 비전공 개발자
- MAC
- image
- 풀스택
- HTML
- CSS
- 비전공자
- ipad
- css3
- javascript
- iPhone
- 백엔드
- xcode
- 개발자
- front-end
- button
- 자바스크립트
- keyframes
- iOS 개발자
- php
Archives
- Today
- Total
비전공자 개발일기
Heart Animation Effects 본문
728x90
SMALL

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HEART ANIMATION EFFECTS</title>
<link rel="stylesheet" href="style.css">
<script defer src="main.js"></script>
</head>
<body>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
min-height: 100vh;
background-color: #111;
overflow: hidden;
}
span {
position: absolute;
pointer-events: none;
filter: drop-shadow(0 0 15px rgba(0, 0, 0, .6));
animation: fadeInOut 1s linear infinite
}
@keyframes fadeInOut {
0%, 100% {
opacity: 0;
}
20%, 80% {
opacity: 1;
}
}
span::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: url('./heart.png');
background-size: cover;
animation: moveShape 1s linear infinite
}
@keyframes moveShape {
0% {
transform: translate(0) rotate(0);
}
100% {
transform: translate(300px) rotate(360deg);
}
}
document.addEventListener('mousemove', function(e) {
let body = document.querySelector("body");
let heart = document.createElement("span");
let x = e.offsetX;
let y = e.offsetY;
heart.style.left = `${x}px`;
heart.style.top = `${y}px`;
let size = Math.random() * 80;
heart.style.width = `${20 + size}px`;
heart.style.height = `${20 + size}px`;
let transformValue = Math.random() * 360;
heart.style.transform = `rotate(${transformValue}deg)`;
body.appendChild(heart);
setTimeout(function() {
heart.remove()
}, 1000);
})
728x90
LIST
'Javascript' 카테고리의 다른 글
Chatbot (0) | 2022.07.08 |
---|---|
QR code Generator (0) | 2022.07.07 |
Javascript Particles (0) | 2022.07.05 |
Analog Clock (0) | 2022.07.03 |
Automatic Image Slider (0) | 2022.06.30 |