document.addEventListener("DOMContentLoaded", function () { const canvas = document.createElement("canvas"); canvas.style.position = "fixed"; canvas.style.top = "0"; canvas.style.left = "0"; canvas.style.pointerEvents = "none"; canvas.style.zIndex = "9999"; document.body.appendChild(canvas); const ctx = canvas.getContext("2d"); let width = window.innerWidth + 100; let height = window.innerHeight; canvas.width = width; canvas.height = height; const flakes = []; // Загружаем изображения для снежинок const snowflakeImages = ["/sneg.png", "/sneg2.png"]; const snowflakes = []; let img1 = new Image(); img1.src = snowflakeImages[0]; let img2 = new Image(); img2.src = snowflakeImages[1]; // Создаем снежинку с отклонением по горизонтали function createFlake() { const randomImage = Math.random() > 0.5 ? img1 : img2; // Выбираем случайное изображение return { x: Math.random() * width, y: Math.random() * height * 0.5, // Появление снежинок в верхней половине экрана image: randomImage, // Присваиваем изображение width: 13 + Math.random() * 5, // Ширина изображения снежинки height: 13 + Math.random() * 5, // Высота изображения снежинки speed: Math.random() * 5 + 0.5, // Скорость падения direction: (Math.random() - 0.5) * 2, // Направление горизонтального отклонения (-1 до 1) drift: Math.random() * 0.5 - 0.1, // Медленное горизонтальное отклонение со временем }; } // Рисуем снежинки function drawFlakes() { ctx.clearRect(0, 0, width, height); // Очистить экран // Рисуем падающие снежинки flakes.forEach((flake) => { ctx.drawImage(flake.image, flake.x, flake.y, flake.width, flake.height); }); } // Двигаем снежинки с эффектом отскока от краев function moveFlakes() { flakes.forEach((flake, index) => { flake.y += flake.speed; // Падение вниз flake.x += flake.direction + flake.drift; // Горизонтальное отклонение // Отскок при достижении левого или правого края экрана if (flake.x < 0 || flake.x > width) { flake.direction = -flake.direction; // Меняем направление на противоположное // Плавное возвращение к центру экрана flake.x = Math.min(Math.max(flake.x, 0), width); } // Если снежинка выходит за нижнюю границу экрана, перемещаем её обратно в верхнюю часть if (flake.y > height) { flake.y = -flake.height; // Переходит в верхнюю часть flake.x = Math.random() * width; // Новая случайная позиция по горизонтали } }); // Добавляем новые снежинки, чтобы поддерживать их количество while (flakes.length < 100) { // Поддерживаем количество снежинок flakes.push(createFlake()); } } // Анимация function loop() { drawFlakes(); moveFlakes(); requestAnimationFrame(loop); } // Инициализация снежинок for (let i = 0; i < 100; i++) { flakes.push(createFlake()); } // Адаптация к изменению размера окна window.addEventListener("resize", () => { width = window.innerWidth + 100; height = window.innerHeight; canvas.width = width; canvas.height = height; }); loop(); });
Flowers

Articles

DECORATIVE MOLDING ELEMENTS

 

Moldings were a symbol of beauty in most old buildings. They can be seen in the ceiling corners of rooms, along walls, and around door frames. Moldings are the hallmark of any apartment and give the house an elegant look. The only requirement is that you have enough ceiling height to let your creativity run wild.

More
Flowers

MOLDINGS IN ART DECO STYLE

 

Moldings play an important role in Art Deco style, helping to create its character and atmosphere. In this style, moldings are often used to emphasize geometric shapes, add decorative details, and give the interior a luxurious and elegant look.

More
Flowers

MOLDINGS IN FRENCH STYLE
 

The moldings and decors used depending on the rooms of the houses bring French luxury to every corner of the house and look effective and beautiful. Although there are many different French styles, country and modern Parisian styles are predominant. Each French-style home has its own characteristics, but many of us want to add this quality to our stylish home. we went so far as to turn our entire house into a French pattern house. 

More
Flowers

NEOCLASSICAL DECORATIVE MOLDING

 

Decorative moldings in the neoclassical style have sophistication, elegance and luxury. They are an important part of the architectural design in neoclassical terrier design and add sophistication and character to the space.

More
Flowers

HOW TO DECORATE WALLS WITH MOLDINGS?
 

Wall molding is a multi-functional decorative element that will help serve as the focal point of a room. Decorating walls with moldings is suitable for cladding with bright inserts, mirror elements, paintings, photographs, panels and posters.

More
Flowers
© Molding. All rights reserved