
apple ์น์ฌ์ดํธ์์
transformY๋์transform3d๋ฅผ ์ฐ๋ ์ด์ => 3d ๋ถ์ ์ ๋ค์ GPU๋ฅผ ์จ์ ํ๋์จ์ด ๊ฐ์,์ฆ, y์ถ์ผ๋ก๋ง ์ด๋ํด๋ 3d๋ฅผ ์ด์ฉํ๋ฉด ํผํฌ๋จผ์ค ํฅ์
๊ทผ๋ฐ ๊ทธ๋ฅ translate ์์ฒด๊ฐ ํผํฌ๋จผ์ค๊ฐ ์ข๊ธดํจ
.stage {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
background-color: #333;
/* perspective: 800px; */
}
.door-body {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
transition: 0.5s;
transform-origin: left;
}
.door:nth-child(1) .door-body {
background: rgba(255, 0, 0, 0.7);
}
.door:nth-child(2) .door-body {
background: rgba(0, 255, 0, 0.7);
}
.door:nth-child(3) .door-body {
background: rgba(0, 0, 255, 0.7);
}
.door:hover .door-body {
transform: perspective(800px) rotateY(-110deg);
}
์๋์ ๋์ง๋ง, ๋ณ๋ก์. DOM ์ ์ ๊ทผํ๋ ๊ฑด ์ฐ์ฐ์๋ ๊ฐ์ฅ ๋๋ฆฐ ๊ฒ ์ค ํ๋!
๊ฒ๋ค๊ฐ, DOM Script๊ฐ ์๋ ๊ฒฝ์ฐ(์๋ฅผ ๋ค๋ฉด, canvas) ์ฟผ๋ฆฌ์ ๋ ํฐ๋ก ๋ชป์ก์๋์ฆ, ๋ฒ์ฉ์ ์ผ๋ก ์๊ฐํ๋ฉด ํด๋์ค๋ก ์ ๊ทผํ๋ ๊ฑด ๋ฐ๋์งํ์ง ์์
(function () {
const stageElm = document.querySelector('.stage');
function doorHandler(e) {
const targetElm = e.target;
const currentItem = document.querySelector('.door-opened');
if (currentItem) {
currentItem.classList.remove('door-opened');
}
if (targetElm.classList.contains('door-body')) {
targetElm.parentNode.classList.add('door-opened');
}
}
stageElm.addEventListener('click', doorHandler);
})();
(function () {
const stageElm = document.querySelector('.stage');
// ํ์ฌ ํ์ฑํ๋ ์์ดํ
์ ์ ์ฅ
let currentItem;
function doorHandler(e) {
const targetElm = e.target;
if (currentItem) {
currentItem.classList.remove('door-opened');
}
if (targetElm.classList.contains('door-body')) {
targetElm.parentNode.classList.add('door-opened');
currentItem = targetElm.parentNode; // door
}
}
stageElm.addEventListener('click', doorHandler);
})();
์ด๋ฒคํธ ํธ๋ค๋ฌ๋ ์ต๋ํ ๊ฐ๊ฒฐํ๊ฒ ํด์ผํจ! ํจ์๋ก ๋ ์ชผ๊ฐ์. ํ ํจ์ ์์ ํ์ฑํ/๋นํ์ฑํ ๊ธฐ๋ฅ์ด ๋ค ์์... ๋ฆฌํฉํ ๋ง ํด๋ณด์
(function () {
const stageElm = document.querySelector('.stage');
// ํ์ฌ ํ์ฑํ๋ ์์ดํ
์ ์ ์ฅ
let currentItem;
// ํ์ฑํ
function activate(elm) {
elm.classList.add('door-opened');
currentItem = elm; // door
}
// ๋นํ์ฑํ
function inactivate(elm) {
elm.classList.remove('door-opened');
}
function doorHandler(e) {
const targetElm = e.target;
if (currentItem) {
inactivate(currentItem);
}
if (targetElm.classList.contains('door-body')) {
activate(targetElm.parentNode);
}
}
stageElm.addEventListener('click', doorHandler);
})();
ํ์ด์ง ๋ก๋ํ์๋ง์ 1๋ฒ ์ด๋ฏธ์ง ์ด๋ฆฐ ์ํ ์ค์ ์ฝ๊ฒ ๊ฐ๋ฅ
activate(document.querySelector('.door:nth-child(1)'));

An RGB Door offers a modern and stylish addition to any home, combining cutting-edge technology with sleek aesthetics. These doors are designed to enhance the ambiance of your living space with customizable color options that can be adjusted to fit any mood or occasion. Whether you're looking for a statement piece for your entryway or a functional upgrade for your interior, RGB doors provide both beauty and practicality. For top-notch installation services, you can rely on professionals from palmcoastdoorinstallation.com to ensure your new RGB door is installed with precision and care, bringing your vision to life