본문 바로가기
Js

폴리곤. 컬러 로테이션 hue-rotate

by 영감은어디에 2025. 2. 24.

let container = document.querySelector('.container');
for (let i = 0; i < 12; i++){
	let row = document.createElement('div'); 
    row.classList.add('row');
	for (let j = 0; j < 20; j++){
    	let box = document.createElement('div'); box.classList.add('box');
		box.style.filter = `hue-rotate(${i * 36}deg)`; 
    	row.appendChild(box);
	}
	container.appendChild(row);
}
.row { display: inline-flex; margin-top: -32px; margin-left: -50px;}
.row:nth-child(even) { margin-left: 1px;}
.row .box {
    position: relative;
    width: 100px;
    height: 110px;
    background: #0c0c0c;
    margin: 2px;
    transition: 2s;
    clip-path: polygon (50% 0%, 100% 25%, 100% 75%, 50% 100%,0% 75%,0% 25%);}
.row .box:hover { 
	transition: 0s; 
    background: #0f0;}
.row .box::before {
    content: ''
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: rgba(255,255,255,0.02);}

'Js' 카테고리의 다른 글

circle, strokeDashoffset, scrollTop, 그래프  (0) 2025.03.06
gsap, mouse move  (0) 2025.03.05
원페이지 스크롤  (0) 2025.03.03
menu bar mouse move  (0) 2025.02.25
createElement, mouse move  (0) 2025.02.23
Lottie json 파일 단순 마우스 오버 효과  (0) 2024.10.17
replace(), 유튜브 클릭시 오토플레이  (0) 2024.07.17
숫자 카운터  (0) 2024.07.17