DEV Community

rfidcard
rfidcard

Posted on

RFID Website Frontend Effects Code with Explanation

RFID Website Frontend Effects Code with Explanation
Here's a modern RFID-themed website frontend with interactive effects, written in HTML, CSS, and JavaScript, along with explanations:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RFID Solutions - Interactive Demo</title>
    <style>
        /* Base Styles */
        :root {
            --primary-color: #0066cc;
            --secondary-color: #004d99;
            --accent-color: #00cc99;
            --dark-color: #1a1a1a;
            --light-color: #f5f5f5;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            color: var(--dark-color);
            background-color: var(--light-color);
            overflow-x: hidden;
        }

        /* Header with RFID scan animation */
        header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 2rem 0;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .rfid-scan-line {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 2px;
            background: var(--accent-color);
            box-shadow: 0 0 10px var(--accent-color);
            animation: scan 2s infinite linear;
            opacity: 0;
        }

        @keyframes scan {
            0% {
                transform: translateY(100%);
                opacity: 1;
            }
            100% {
                transform: translateY(-100%);
                opacity: 0;
            }
        }

        /* RFID Card Container with hover effects */
        .rfid-card-container {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 2rem;
            padding: 3rem 1rem;
        }

        .rfid-card {
            background: white;
            border-radius: 10px;
            padding: 2rem;
            width: 300px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .rfid-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
        }

        .rfid-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: var(--accent-color);
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }

        .rfid-card:hover::before {
            transform: scaleX(1);
        }

        /* RFID Tag Visualization */
        .rfid-tag {
            width: 100px;
            height: 60px;
            background: linear-gradient(135deg, var(--dark-color), #333);
            border-radius: 5px;
            margin: 1rem auto;
            position: relative;
            overflow: hidden;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
        }

        .rfid-tag::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 60%;
            height: 60%;
            background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
            transform: translate(-50%, -50%);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .rfid-tag:hover::after {
            opacity: 1;
        }

        /* Interactive RFID Reader Animation */
        .rfid-reader {
            width: 200px;
            height: 200px;
            margin: 3rem auto;
            position: relative;
            background: conic-gradient(var(--primary-color) 0%, var(--secondary-color) 50%, var(--primary-color) 100%);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: 0 0 20px rgba(0, 102, 204, 0.3);
            animation: rotate 8s linear infinite;
        }

        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .rfid-reader::before {
            content: '';
            position: absolute;
            width: 80%;
            height: 80%;
            background: var(--light-color);
            border-radius: 50%;
        }

        /* Data Visualization Effect */
        .data-visualization {
            display: flex;
            justify-content: space-around;
            padding: 2rem;
            background: white;
            margin: 2rem;
            border-radius: 10px;
        }

        .data-bar {
            width: 30px;
            background: var(--accent-color);
            border-radius: 5px;
            margin: 0 10px;
            transition: height 0.5s ease;
            position: relative;
        }

        .data-bar::after {
            content: attr(data-value);
            position: absolute;
            bottom: -25px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 0.8rem;
            color: var(--dark-color);
        }
    </style>
</head>
<body>
    <!-- Header with RFID scan animation -->
    <header>
        <h1>RFID Solutions</h1>
        <p>Next Generation Identification Technology</p>
        <div class="rfid-scan-line"></div>
    </header>

    <!-- RFID Card Section with hover effects -->
    <section class="rfid-card-container">
        <div class="rfid-card">
            <h2>Access Control</h2>
            <div class="rfid-tag"></div>
            <p>Secure building access with RFID technology. Track entry and exit in real-time.</p>
        </div>

        <div class="rfid-card">
            <h2>Inventory Management</h2>
            <div class="rfid-tag"></div>
            <p>Automate inventory tracking with RFID tags. Reduce human error and save time.</p>
        </div>

        <div class="rfid-card">
            <h2>Asset Tracking</h2>
            <div class="rfid-tag"></div>
            <p>Monitor valuable assets in real-time. Get alerts when items move unexpectedly.</p>
        </div>
    </section>

    <!-- Interactive RFID Reader -->
    <div class="rfid-reader"></div>

    <!-- Data Visualization Section -->
    <section class="data-visualization">
        <div class="data-bar" data-value="85%" style="height: 85%;"></div>
        <div class="data-bar" data-value="60%" style="height: 60%;"></div>
        <div class="data-bar" data-value="95%" style="height: 95%;"></div>
        <div class="data-bar" data-value="45%" style="height: 45%;"></div>
    </section>

    <script>
        // JavaScript for interactive effects
        document.addEventListener('DOMContentLoaded', function() {
            // Add pulse effect to RFID reader on hover
            const reader = document.querySelector('.rfid-reader');

            reader.addEventListener('mouseenter', function() {
                this.style.animationDuration = '2s';
            });

            reader.addEventListener('mouseleave', function() {
                this.style.animationDuration = '8s';
            });

            // Add dynamic data bar animation
            const dataBars = document.querySelectorAll('.data-bar');

            dataBars.forEach(bar => {
                const originalHeight = bar.style.height;
                bar.style.height = '0%';

                setTimeout(() => {
                    bar.style.height = originalHeight;
                }, 100);
            });

            // RFID tag click effect (simulating tag reading)
            const tags = document.querySelectorAll('.rfid-tag');

            tags.forEach((tag, index) => {
                tag.addEventListener('click', function() {
                    // Create a ripple effect
                    const ripple = document.createElement('span');
                    ripple.className = 'ripple';
                    this.appendChild(ripple);

                    // Remove ripple after animation
                    setTimeout(() => {
                        ripple.remove();
                    }, 1000);

                    // Show alert with tag info
                    const messages = [
                        "Access granted to Sector 5",
                        "Inventory item #4521 scanned",
                        "Asset #789 moved to Zone 3",
                        "Tag #321 battery level: 85%"
                    ];
                    alert(messages[index]);
                });
            });

            // Add ripple effect style dynamically
            const style = document.createElement('style');
            style.textContent = `
                .ripple {
                    position: absolute;
                    border-radius: 50%;
                    background-color: rgba(255, 255, 255, 0.7);
                    transform: scale(0);
                    animation: ripple 0.6s linear;
                    pointer-events: none;
                }

                @keyframes ripple {
                    to {
                        transform: scale(4);
                        opacity: 0;
                    }
                }
            `;
            document.head.appendChild(style);
        });
    </script>
</body>
</html>

Enter fullscreen mode Exit fullscreen mode

Code Explanation
HTML Structure
Header Section: Contains the main title with an animated RFID scan line effect
RFID Card Container: Three cards demonstrating different RFID applications with hover effects
RFID Reader Visualization: A circular animated element representing an RFID reader
Data Visualization: Simple bar charts showing RFID-related metrics
CSS Effects
Scan Line Animation: The @keyframes scan animation creates a moving light effect resembling an RFID scanner
Card Hover Effects: Cards lift up and show a colored top border when hovered
RFID Tag Visualization: Tags have a subtle glow effect on hover to simulate activation
Reader Animation: A conic gradient circle that rotates continuously (speeds up on hover)
Data Bars: Bars animate from 0% to their specified height for visual appeal
JavaScript Interactivity
Reader Speed Change: The rotation speed changes when hovering over the reader
Data Bar Animation: Bars animate from 0 to their full height on page load
Tag Click Effect:
Creates a ripple animation when clicking an RFID tag
Shows an alert with mock RFID data (different for each tag)
Dynamic Style Addition: The ripple effect style is added dynamically to keep the main CSS clean
Key Features
Modern, responsive design
Smooth CSS transitions and animations
Interactive elements with JavaScript
RFID-themed visual elements throughout
Clean, well-commented code structure
This code creates an engaging, interactive RFID-themed website that demonstrates the technology through visual effects and animations.

technical support:
https://www.tjnfctag.com/

Top comments (0)