Introduction
In this tutorial, we’ll create an ultra-premium, 3D gladiator-themed product showcase featuring animated product cards, dynamic hover effects, click interactions, and a glowing particle effect that brings each item to life. Designed for immersive user experiences, this showcase combines 3D transformations, glowing animations, and pulsating highlights to give each product a unique and interactive feel. This design is inspired by Gladiators Battle, an interactive game where players experience the thrill of ancient battles and strategy.
Follow along to create your own interactive product showcase and learn how to use HTML, CSS, and JavaScript for stunning visuals and dynamic animations.
Step 1: Setting Up the HTML Structure
Each product card represents a gladiator-themed item, like a shield or sword, with interactive elements such as badges, icons, and stats.
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>3D Gladiator Product Showcase</title> <link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <div> <p>Key HTML Elements<br> Badge: Labels each item with statuses like "New" or "Popular."<br> Product Image: Displays the item with a glowing effect and 3D depth.<br> Stats: Uses progress bars to display item attributes like defense or attack.<br> Icons: Interactive icons at the bottom of each card provide quick access to favorite actions.<br> Step 2: Designing with CSS<br> Basic Styles and Background<br> The background uses a radial gradient to create a dramatic look, while each product card is styled with gradients, shadows, and smooth transitions.<br> </p> <pre class="brush:php;toolbar:false">body { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: radial-gradient(circle at center, #1b1b2f, #090909); font-family: Arial, sans-serif; overflow: hidden; color: #fff; } .product-showcase { display: flex; gap: 40px; perspective: 1200px; }
Product Card Styles
Each card is designed with a 3D look and includes hover effects for interactivity. The :hover effect provides a subtle rotation and glow, enhancing the premium feel.
.product-card { position: relative; width: 270px; height: 420px; padding: 25px; background: linear-gradient(145deg, #2a2a2a, #3c3c3c); border-radius: 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 215, 0, 0.5); display: flex; flex-direction: column; align-items: center; justify-content: center; transform-style: preserve-3d; transition: transform 0.5s, box-shadow 0.5s, background 0.5s; cursor: pointer; overflow: hidden; } .product-card:hover { transform: scale(1.1) rotateY(10deg); box-shadow: 0 30px 60px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 255, 0, 0.7); }
Stats and Progress Bars
We use progress bars to display attributes such as defense and durability, which add a unique visual element to the showcase.
.stats { width: 100%; margin-top: 15px; } .stat-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #ffd700; font-size: 14px; font-weight: bold; } .progress { width: 60%; height: 8px; background: rgba(255, 255, 255, 0.2); border-radius: 5px; } .progress-bar { height: 100%; background: linear-gradient(90deg, #ffcc00, #f9844a); }
Adding Particle Effects
Adding particles that move and change color enhances the immersive feel. These particles can pulsate to give a glowing effect.
.particle { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 215, 0, 0.9); box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 255, 0, 0.3); animation: particleAnimation 3s ease-in-out infinite, particleMove 4s linear infinite; }
Step 3: Adding JavaScript Interactivity
The JavaScript manages hover animations, click events, and the glowing particle effect.
Adding Hover and Click Animations
We animate the card rotation and scaling on mouse movement and toggle zoom with a click.
const cards = document.querySelectorAll('.product-card'); cards.forEach((card) => { let isClicked = false; card.addEventListener('mousemove', (e) => { if (!isClicked) { const { width, height } = card.getBoundingClientRect(); const offsetX = e.clientX - card.offsetLeft - width / 2; const offsetY = e.clientY - card.offsetTop - height / 2; const rotationX = (offsetY / height) * -25; const rotationY = (offsetX / width) * 25; card.style.transform = `rotateY(${rotationY}deg) rotateX(${rotationX}deg) scale(1.05)`; } }); card.addEventListener('mouseleave', () => { if (!isClicked) { card.style.transform = 'rotateY(0deg) rotateX(0deg) scale(1)'; } }); card.addEventListener('click', () => { isClicked = !isClicked; card.style.transform = isClicked ? 'scale(1.2) rotateY(0deg) rotateX(0deg)' : 'rotateY(0deg) rotateX(0deg) scale(1)'; }); });
Adding Glowing Particles
To enhance the atmosphere, we create particles that move randomly around each product card.
function addParticleEffect() { const particle = document.createElement('div'); particle.classList.add('particle'); particle.style.left = `${Math.random() * 100}%`; particle.style.top = `${Math.random() * 100}%`; particle.style.animationDuration = `${2 + Math.random() * 3}s`; document.body.appendChild(particle); setTimeout(() => particle.remove(), 5000); } setInterval(() => { cards.forEach(() => addParticleEffect()); }, 1000);
Conclusion
Building a 3D gladiator-themed product showcase with dynamic animations and particle effects creates an engaging, interactive experience that can captivate users. By combining CSS for visual styling and JavaScript for interactivity, we’ve created a high-quality, immersive component ideal for product displays or gaming-related sites. Inspired by Gladiators Battle, this showcase highlights the power of combining modern web design with historical themes.
? Discover More:
探索角鬥士之戰:在 https://gladiatorsbattle.com 潛入古代武士和戰略遊戲的世界。
GitHub:查看更多項目:https://github.com/HanGPIErr。
LinkedIn:連結以取得專案更新:https://www.linkedin.com/in/pierre-romain-lopez/。
Twitter:追蹤 https://x.com/GladiatorsBT 以了解設計和開發見解。
請繼續關注有關創建引人入勝的互動式元件的更多教學!
以上是角鬥士產品角鬥士主題產品展示,帶有動態粒子和互動動畫的詳細內容。更多資訊請關注PHP中文網其他相關文章!

具有CSS的自定義光標很棒,但是我們可以將JavaScript提升到一個新的水平。使用JavaScript,我們可以在光標狀態之間過渡,將動態文本放置在光標中,應用複雜的動畫並應用過濾器。

互動CSS動畫和元素相互啟動的元素在2025年似乎更合理。雖然不需要在CSS中實施乒乓球,但CSS的靈活性和力量的增加,可以懷疑Lee&Aver Lee有一天會成為一種

有關利用CSS背景濾波器屬性來樣式用戶界面的提示和技巧。您將學習如何在多個元素之間進行背景過濾器,並將它們與其他CSS圖形效果集成在一起以創建精心設計的設計。

好吧,事實證明,SVG的內置動畫功能從未按計劃進行棄用。當然,CSS和JavaScript具有承載負載的能力,但是很高興知道Smil並沒有像以前那樣死在水中

是的,讓#039;跳上文字包裝:Safari Technology Preview In Pretty Landing!但是請注意,它與在鉻瀏覽器中的工作方式不同。

此CSS-tricks更新了,重點介紹了年鑑,最近的播客出現,新的CSS計數器指南以及增加了幾位新作者,這些新作者貢獻了有價值的內容。

在大多數情況下,人們展示了@Apply的@Apply功能,其中包括Tailwind的單個property實用程序之一(會改變單個CSS聲明)。當以這種方式展示時,@Apply聽起來似乎很有希望。如此明顯


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

Dreamweaver CS6
視覺化網頁開發工具

WebStorm Mac版
好用的JavaScript開發工具

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。