Skip to content

lucasepe/doodlekit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doodlekit

Go Report Card Coverage

Welcome to doodlekit, an open-source Golang framework for creating animated doodles like old school demoscenes and crack intros.

Whether you're a nostalgic coder or a modern enthusiast, doodlekit allows you to craft captivating GIF animations with ease.

Check out the lucasepe/doodles repository for examples of stunning animations created with doodlekit!

Features

  • Simple API: easy-to-use functions to create stunning animations
  • Composable Scenes: you can compose one or more existing scenes with yours
  • Flexible Configuration: options to set frame rate, output directory, and more.
  • Open Source: contribute and expand the framework with your own scenes and animations.
  • GIF Output: generates GIFs for sharing and showcasing

Getting Started

Usage

Here's a basic example to get you started with doodlekit:

package main

import (
    "context"
    "github.com/lucasepe/doodlekit"
)

type MyScene struct{}

func (s *MyScene) Init(ctx context.Context) {
    // Initialize your scene
    // gc := doodlekit.Canvas(Ctx)
}

func (s *MyScene) Update(ctx context.Context, dt float64) {
    // Update scene logic
    // gc := doodlekit.Canvas(Ctx)
}

func (s *MyScene) Draw(ctx context.Context) {
    // Draw your scene
    // gc := doodlekit.Canvas(Ctx)
    // Use `gc` to draw your stuff
}

func main() {
    scenes := []doodlekit.Scene{
        // here you can add eventually 
        // one or more existing scenes
        &MyScene{},
    }

    loop := doodlekit.NewLoop("my-doodle", 
        doodlekit.FPS(24), 
        doodlekit.StopAfter(15))
    loop.Run(scenes)
}

Creating a Scene

To create your own scene, implement the doodlekit.Scene interface:

type Scene interface {
    Init(ctx context.Context)
    Update(ctx context.Context, dt float64)
    Draw(ctx context.Context)
}
  • Init: initialize your scene, load resources, etc.
  • Update: update the scene logic, animations, positions, etc.
  • Draw: render your scene, draw shapes, etc.

Acknowledgements

Special thanks to

License

This project is licensed under the BSD 2-Clause License. See the LICENSE file for details.