← Back to gallery
Dying Of The Light poster

Project walkthrough

Dying Of The Light

Explore the concept, hints, and starter code for this Nic Cage inspired build.

Title: Illuminate Performance with Dying of the Light and Performance API

Description:

Inspired by Nicolas Cage’s intense portrayal of a CIA operative in Dying of the Light, this project utilizes the Performance API to create a web application that monitors and analyzes website performance. The application reflects the urgency and meticulous attention to detail of Cage’s character, Evan Lake, ensuring that users can measure and optimize their site’s performance effectively. The project aims to provide insights into various performance metrics, helping users improve their website’s speed and efficiency.

Features:

  • Performance Monitoring: Track key performance metrics such as load time, response time, and memory usage.
  • Detailed Analysis: Provide insights and suggestions for optimizing website performance.
  • User-Friendly Interface: An intuitive dashboard inspired by the intense and methodical nature of Dying of the Light.

Starting Code:

Beginner Hints:

  • Create a single index.html file.
  • Copy the full HTML code block into that file.
  • Open index.html in your browser. If something doesn’t work, try a local server like python -m http.server.
  • Open DevTools Console to spot errors and typos quickly.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Illuminate Performance with Dying of the Light</title>
<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #333;
        color: #f2f2f2;
        text-align: center;
        padding: 20px;
    }
    #dashboard {
        margin: 0 auto;
        width: 80%;
        background-color: #444;
        padding: 20px;
        border-radius: 10px;
    }
    .metric {
        margin: 20px 0;
        padding: 10px;
        border: 1px solid #555;
        border-radius: 5px;
        background-color: #555;
    }
    button {
        background-color: #e74c3c;
        color: white;
        border: none;
        padding: 10px 20px;
        cursor: pointer;
        border-radius: 5px;
        font-size: 16px;
        margin-top: 20px;
    }
    button:hover {
        background-color: #c0392b;
    }
</style>
</head>
<body>
    <h1>Illuminate Performance with Dying of the Light</h1>
    <p>Monitor and optimize your website's performance with precision and urgency.</p>

    <div id="dashboard">
        <div class="metric">
            <h2>Page Load Time</h2>
            <p id="load-time">Calculating...</p>
        </div>
        <div class="metric">
            <h2>Response Time</h2>
            <p id="response-time">Calculating...</p>
        </div>
        <div class="metric">
            <h2>Memory Usage</h2>
            <p id="memory-usage">Calculating...</p>
        </div>
    </div>

    <button onclick="analyzePerformance()">Analyze Performance</button>
<script>
    function analyzePerformance() {
        const performanceData = window.performance.getEntriesByType('navigation')[0];

        if (performanceData) {
            document.getElementById('load-time').textContent = (performanceData.loadEventEnd - performanceData.startTime).toFixed(2) + ' ms';
            document.getElementById('response-time').textContent = (performanceData.responseEnd - performanceData.requestStart).toFixed(2) + ' ms';
        }

        if (window.performance.memory) {
            const memoryUsage = window.performance.memory.usedJSHeapSize / 1048576;
            document.getElementById('memory-usage').textContent = memoryUsage.toFixed(2) + ' MB';
        } else {
            document.getElementById('memory-usage').textContent = 'Memory API not supported.';
        }
    }
</script>
</body>
</html>

References:

Project Overview:

This project integrates the meticulous and intense nature of Dying of the Light with the Performance API to help users monitor and optimize their website’s performance. By providing detailed metrics and actionable insights, the application ensures that users can improve their site’s speed and efficiency. Embrace the urgency and precision of Nicolas Cage’s character to master web performance monitoring and optimization. Praise Cage!