Overview
Concrete tool for rendering a canvas-based animation of a pelican riding a bike, provided as a jcode demo asset.
Description
The pelican.js file is a self-executing IIFE that renders a hand-drawn-style animation on an HTML5 Canvas. It depicts a pelican on a bicycle with an ink-and-cream color palette (deep ink, cream, paper, coral, sea, gold). The 1600x900 canvas runs a 12-second loop at the browser's refresh rate, with a responsive resize that accounts for device pixel ratio. The animation includes a sky with sun, clouds, and birds; a layered sea with shimmer and wave lines; a road with moving dashes, roadside plants, and foreground grass; and a detailed pelican character with blinking eyes, flapping wings, a flowing scarf, pedaling legs, and a basket of flowers and fish.
Usage
- Demo playback: Open the accompanying HTML page in a browser; the animation starts automatically.
- Manual time scrubbing: Append
?t=N to the URL to seek to a specific second within the 12-second loop.
- Programmatic control: Use the
window.pelicanAnimation API to setTime(), play(), or read loopDuration.
Code Reference
Source Location
Signature
// IIFE — no module exports.
// Public API attached to window.pelicanAnimation:
window.pelicanAnimation = {
setTime(seconds: number): void,
play(): void,
get loopDuration(): number, // 12
};
Import
<!-- Loaded via a <script> tag in the accompanying HTML page -->
<script src="pelican.js"></script>
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| #pelican-canvas |
HTMLCanvasElement |
Yes /// Canvas element in the DOM
|
| ?t query param |
number |
No /// Manual time offset in seconds (0-12)
|
Outputs
| Name |
Type |
Description
|
| Canvas rendering |
visual /// Animated pelican-on-bike drawn to the canvas
|
| window.pelicanAnimation |
object /// Programmatic control API
|
Usage Examples
Basic Embed
<canvas id="pelican-canvas"></canvas>
<script src="pelican.js"></script>
<!-- Animation starts automatically -->
Programmatic Time Control
// Seek to 6 seconds into the loop
window.pelicanAnimation.setTime(6);
// Resume playback from that point
window.pelicanAnimation.play();
// Read the loop duration
console.log(window.pelicanAnimation.loopDuration); // 12
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.