← Back to gallery
Season Of The Witch poster

Project walkthrough

Season Of The Witch

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

Project Title: “Season of the Witch: Enchanted Web Animations with Houdini API”

Description:

In this project, we blend the mystical and adventurous elements of Season of the Witch with the capabilities of the Houdini API. Season of the Witch follows knights on a mission to transport a suspected witch to a monastery, dealing with themes of magic and the supernatural. Similarly, this project will enable users to create and control advanced web animations using the Houdini API, bringing a touch of enchantment to web design.

Features:

  1. Advanced Animations: Use the Houdini API to create custom CSS animations and effects.
  2. Interactive Controls: Allow users to interact with and control the animations dynamically.
  3. Thematic Design: Implement a mystical design inspired by the enchanting atmosphere of Season of the Witch.

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.

Here’s a basic setup to get you started. This includes the initial HTML, CSS, and JavaScript to integrate the Houdini API and create enchanted web animations.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Season of the Witch: Enchanted Web Animations</title>
<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #111;
        color: #fff;
        text-align: center;
        padding: 20px;
    }

    h1 {
        color: #ff4500;
    }

    #animationContainer {
        position: relative;
        width: 300px;
        height: 300px;
        margin: 20px auto;
        border: 1px solid #ff4500;
    }

    .animated-box {
        width: 50px;
        height: 50px;
        background-color: #ff4500;
        position: absolute;
    }

    button {
        background-color: #ff4500;
        color: white;
        border: none;
        padding: 10px 20px;
        font-size: 16px;
        cursor: pointer;
        margin: 5px;
    }

    @keyframes moveBox {
        from {
            transform: translate(0, 0);
        }
        to {
            transform: translate(250px, 250px);
        }
    }

    .animated-box {
        animation: moveBox 5s infinite alternate;
        paint: boxPainter;
        --box-color: #ff4500;
    }
</style>
</head>
<body>
    <h1>Season of the Witch: Enchanted Web Animations</h1>
    <p>Bring your web designs to life with the Houdini API!</p>
    <div id="animationContainer">
        <div class="animated-box"></div>
    </div>
    <button id="toggleAnimationBtn">Toggle Animation</button>
<script>
    const houdiniWorklet = `class BoxPainter {
        static get inputProperties() {
            return ['--box-color'];
        }

        paint(ctx, geom, properties) {
            const color = properties.get('--box-color').toString() || 'red';
            ctx.fillStyle = color;
            ctx.fillRect(0, 0, geom.width, geom.height);
        }
    }

    registerPaint('boxPainter', BoxPainter);`;

    if ('paintWorklet' in CSS) {
        const workletBlob = new Blob([houdiniWorklet], { type: 'application/javascript' });
        CSS.paintWorklet.addModule(URL.createObjectURL(workletBlob));
    }

    document.getElementById('toggleAnimationBtn').addEventListener('click', () => {
        const box = document.querySelector('.animated-box');
        if (box.style.animation) {
            box.style.animation = '';
        } else {
            box.style.animation = 'moveBox 5s infinite alternate';
        }
    });
</script>
</body>
</html>

References:

Praise Cage! Embark on this coding adventure and create an interactive experience that leverages the Houdini API to bring advanced animations to life, inspired by the mystical world of Season of the Witch.