Skip to content

Flocking simulation animating to your current Spotify playback. Utilizes Spotify's Web Playback SDK to serve as a device you can music cast to.

Notifications You must be signed in to change notification settings

andyruwruw/boid-boogie

Repository files navigation

https://boidboogie.com

Overview

Boid boogie is a flocking simulation that uses Spotify's API and Spotify's Web Playback SDK to match the animations to your current playback.

Largly inspired by Kaleidosync by Zachary Winter. If you like this, you'll love his application.

How it works

Flocking Simulation

Each point, or boid, has a limited perception by which it can see other boids.

It then adjusts its acceleration based on three steering behaviors.

  1. Separation: Push away from other boids.
  2. Cohesion: Pull towards the average position of all nearby boids.
  3. Alignment: Steer towards the average direction neighbors are traveling.

It's that easy!

QuadTree

To make things a little easier to process, a quad tree was used to store and query boids for neighbors.

Allows you to push the number of boids much higher.

Spotify Web Playback SDK

As learned from Kaleidosync, querying Spotify's API for user's current playback to account for seeking, pausing, switching tracks can quickly reach rate limits.

A great way to fix this, implemented in Kaleidosync 2 was to utilize Spotify's Web Playback SDK, essentially turning your site into a device by which user's can play from.

This provides instant access to playback changes.

Spotify's API

Here are two great endpoints used for this project.

About

Flocking simulation animating to your current Spotify playback. Utilizes Spotify's Web Playback SDK to serve as a device you can music cast to.

Topics

Resources

Stars

Watchers

Forks