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 |
Tags
- javascript
- iPhone
- keyframes
- react
- MAC
- css3
- 개발자
- 백엔드
- effect
- php
- image
- xcode
- 비전공 개발자
- HTML
- front-end
- iOS 개발자
- button
- 비전공자
- jQuery
- hover
- ipad
- Animation
- 애니메이션
- CSS
- 풀스택
- SWIFT
- 프론트엔드
- 자바스크립트
- IOS
- html5
Archives
- Today
- Total
비전공자 개발일기
ColorFul Rain 본문
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>COLORFUL RAIN</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 {
background-color: #000;
overflow: hidden;
height: 100vh;
}
i {
position: absolute;
height: 200px;
background: linear-gradient(transparent, #FFF);
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
animation: animate 5s linear infinite;
}
i:nth-child(3n + 1) {
background:linear-gradient(transparent, #ABFFB2);
}
i:nth-child(3n + 2) {
background:linear-gradient(transparent, #FFC4B3);
}
i:nth-child(3n + 3) {
background:linear-gradient(transparent, #E3FFAB);
}
@keyframes animate {
0% {
transform: translateY(-200px);
}
100% {
transform: translateY(calc(100vh + 200px));
}
}
function rain() {
let amount = 80;
let body = document.querySelector("body");
let i = 0;
while(i < amount) {
let drop = document.createElement('i');
let size = Math.random() * 5;
let posX = Math.floor(Math.random() * window.innerWidth);
let delay = Math.random() * - 20;
let duration = Math.random() * 5;
drop.style.width = size + 'px';
drop.style.left = posX + 'px';
drop.style.animationDelay = delay + 's';
drop.style.animationDuration = 1 + duration + 's';
body.appendChild(drop);
i++;
}
}
rain();
728x90
LIST
'Javascript' 카테고리의 다른 글
Word Guess Game (0) | 2022.08.12 |
---|---|
Search Filter (0) | 2022.08.02 |
Notification Bell (0) | 2022.07.27 |
Tic Tae Toc (0) | 2022.07.09 |
Chatbot (0) | 2022.07.08 |