Blast Off with Articulate Storyline: Creating an 8-Bit Space Adventure

Ever dreamed of turning your e-learning course into a retro space odyssey? Well, strap in, because we’re about to embark on a journey that’s out of this world! Let’s dive into how I created a custom 8-bit space animation, complete with a traveling rocket ship, for Articulate Storyline.

The Mission: Engage Learners with Nostalgic Charm

Our goal was simple yet ambitious: create an immersive, space-themed backdrop that would captivate learners from the moment they launch the course. By leveraging the power of custom JavaScript and the flexibility of Articulate Storyline, we’ve crafted an experience that’s both educational and entertaining.

Inspiration

Before we dive into the code, I want to give credit where it’s due. This project was inspired by the amazing work of Jay Chun Ed.D, who created a fascinating straight-on space field animation. Jay’s work sparked the idea to take this concept further and adapt it for our e-learning space adventure.

The Code: Our Launchpad to the Stars

Here’s the full JavaScript code that brings our 8-bit space to life:

// Target the slide layer
const contentArea = document.querySelector('[data-dv_ref="contentArea"]');

// Set canvas dimensions to match the content area
const canvas = document.createElement('canvas');
canvas.width = contentArea.clientWidth;
canvas.height = contentArea.clientHeight;
canvas.style.position = 'absolute';
canvas.style.top = '0';
canvas.style.left = '0';
contentArea.appendChild(canvas);

const ctx = canvas.getContext('2d');

// Colors
const skyColor = '#001636';
const starColor = '#FFFFFF';
const planetColors = ['#D94E3E', '#3DA6FF', '#6EAE79', '#FEDC2E', '#EA842F'];

// Variables for star and planet fields
const numStars = 150;
const numPlanets = 5;
const stars = [];
const planets = [];

// Initialize stars (8-bit look)
for (let i = 0; i < numStars; i++) {
stars.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
size: Math.floor(Math.random() * 3 + 2), // Pixel size for 8-bit
speed: Math.random() * 1 + 0.5,
});
}

// Function to draw blocky, pixel-art-style planets
function drawPixelArtPlanet(ctx, x, y, size, color) {
ctx.fillStyle = color;

// Approximate a pixelated circle with blocky edges
const blockSize = Math.floor(size / 3); // Control block size
// Create a rough "round" shape using blocks
const pattern = [
[0, 1, 1, 1, 0], // Top row (middle block)
[1, 1, 1, 1, 1], // Full block row
[1, 1, 1, 1, 1], // Full block row
[1, 1, 1, 1, 1], // Full block row
[0, 1, 1, 1, 0], // Bottom row (middle block)
];
for (let row = 0; row < pattern.length; row++) {
for (let col = 0; col < pattern[row].length; col++) {
if (pattern[row][col] === 1) {
ctx.fillRect(
x + (col - 2) * blockSize, // Horizontal offset
y + (row - 2) * blockSize, // Vertical offset
blockSize, blockSize
);
}
}
}
}

// Initialize planets (blocky pixel-art style)
for (let i = 0; i < numPlanets; i++) {
planets.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
size: Math.floor(Math.random() * 15 + 10), // Size for pixelated planet
speed: Math.random() * 0.5 + 0.1,
color: planetColors[Math.floor(Math.random() * planetColors.length)],
});
}

// Main animation loop
function animate() {
// Clear canvas
ctx.fillStyle = skyColor;
ctx.fillRect(0, 0, canvas.width, canvas.height);

// Draw and move 8-bit stars
ctx.fillStyle = starColor;
stars.forEach(star => {
for (let i = 0; i < star.size; i++) {
for (let j = 0; j < star.size; j++) {
ctx.fillRect(star.x + i, star.y + j, 1, 1); // Draw pixel blocks
}
}
// Move star to the left
star.x -= star.speed;
if (star.x < 0) {
star.x = canvas.width;
star.y = Math.random() * canvas.height;
}
});

// Draw and move blocky pixel-art planets
planets.forEach(planet => {
drawPixelArtPlanet(ctx, planet.x, planet.y, planet.size, planet.color);
// Move planet to the left
planet.x -= planet.speed;
if (planet.x < 0) {
planet.x = canvas.width;
planet.y = Math.random() * canvas.height;
}
});

requestAnimationFrame(animate);
}

// Start the animation
animate();

Breaking Down the Cosmic Code

Let’s explore the key components of our space animation:

  1. Canvas Setup: We create a canvas that covers the entire Storyline slide, giving us a vast space to work with.
  2. Stars and Planets: We generate an array of stars and planets, each with unique properties like position, size, and speed.
  3. 8-Bit Aesthetics: The drawPixelArtPlanet function creates blocky, pixelated planets that fit our retro theme.
  4. Animation Loop: The animate function continuously updates the positions of stars and planets, creating the illusion of movement through space.
  5. Responsive Design: By setting the canvas dimensions to match the content area, we ensure the animation looks great on any device.

The Impact on Learning

This isn’t just about pretty visuals – the space theme serves several important functions:

  1. Immediate Engagement: The unique, nostalgic aesthetic immediately grabs the learner’s attention.
  2. Thematic Consistency: The space theme can be tied into the course content, reinforcing learning objectives.
  3. Progress Visualization: The journey through space becomes a metaphor for progression through the course.
  4. Reduced Cognitive Load: The soothing, continuous animation can actually help reduce stress and improve focus.

Implementing in Your Own Projects

Excited to launch your own cosmic e-learning adventure? Here are some tips:

  1. Start Small: Begin with simple animations and build complexity gradually.
  2. Test Thoroughly: Ensure your animations work smoothly across different devices and browsers.
  3. Tie It to Content: Find creative ways to link the space theme to your course material.
  4. Customize: Adapt the colors, speed, and density of the space elements to match your course’s tone.

Ready for Liftoff?

This 8-bit space animation has truly transformed our e-learning project, turning a standard course into an engaging adventure. It’s a testament to the power of creative design in online learning.

Want to see it in action or get the code for your own projects? Check out our live demo and visit our store to blast off with your own space-themed e-learning course!

Remember, in the world of e-learning, the sky is not the limit – it’s just the beginning. Happy space travels, fellow instructional astronauts!

Watch video below.