← Back to gallery
211 poster

Project walkthrough

211

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

Title: Tactical Heist with 211 and Canvas API

Description:

Inspired by Nicolas Cage’s action-packed role in 211, this project uses the Canvas API to create an interactive web application that simulates a tactical heist scenario. The application allows users to draw and visualize a heist plan, reflecting the intense and strategic nature of the film. Users can draw shapes, plan routes, and simulate heist dynamics, providing a hands-on experience of strategic planning and execution.

Features:

  • Interactive Drawing: Use the Canvas API to draw and visualize heist plans.
  • Dynamic Interactions: Allow users to create and manipulate shapes, routes, and elements on the canvas.
  • Thematic Design: Reflect the intense and tactical atmosphere of 211 through the application’s design and interactions.

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>Tactical Heist with 211 and Canvas API</title>
<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #1c1c1c;
        color: #f0f0f0;
        text-align: center;
        padding: 50px;
    }
    .container {
        max-width: 800px;
        margin: 0 auto;
        padding: 20px;
        background-color: #2e2e2e;
        border: 1px solid #444;
        border-radius: 10px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    }
    h1 {
        margin-bottom: 20px;
        color: #ff6347;
    }
    canvas {
        background-color: #fff;
        border: 2px solid #444;
        border-radius: 10px;
        cursor: crosshair;
    }
    .controls {
        margin-top: 20px;
    }
    button {
        padding: 10px 20px;
        margin: 10px;
        border-radius: 5px;
        border: none;
        font-size: 16px;
        background-color: #007bff;
        color: white;
        cursor: pointer;
    }
    button:hover {
        background-color: #0056b3;
    }
</style>
</head>
<body>
    <div class="container">
        <h1>Tactical Heist</h1>
        <p>Plan and execute your heist inspired by 211.</p>

        <canvas id="heistCanvas" width="600" height="400"></canvas>
        <div class="controls">
            <button id="clearButton">Clear</button>
        </div>
    </div>
<script>
    const canvas = document.getElementById('heistCanvas');
    const ctx = canvas.getContext('2d');
    const clearButton = document.getElementById('clearButton');
    let drawing = false;

    canvas.addEventListener('mousedown', (e) => {
        drawing = true;
        ctx.beginPath();
        ctx.moveTo(e.offsetX, e.offsetY);
    });

    canvas.addEventListener('mousemove', (e) => {
        if (drawing) {
            ctx.lineTo(e.offsetX, e.offsetY);
            ctx.stroke();
        }
    });

    canvas.addEventListener('mouseup', () => {
        drawing = false;
        ctx.closePath();
    });

    canvas.addEventListener('mouseleave', () => {
        drawing = false;
        ctx.closePath();
    });

    clearButton.addEventListener('click', () => {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
    });
</script>
</body>
</html>

References:

Project Overview:

This project captures the intense and tactical atmosphere of 211 using the Canvas API to enable users to draw and visualize heist plans. Users can create and manipulate shapes, plan routes, and simulate heist dynamics, providing a hands-on experience of strategic planning and execution. The application demonstrates the practical use of the Canvas API for creating interactive and dynamic visualizations. Embrace the intensity and strategic planning of Nicolas Cage’s character to master the use of the Canvas API in web development. Praise Cage!