ledgend

package module
v0.0.0-...-ff612b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2019 License: MIT Imports: 4 Imported by: 3

README

franeklubi/ledgend

GoDoc

Welcome, You absolute ledgend!

ledgend is a Go library aiming to provide a simple API for creating animations You can use to display on a LED strip.

A server for sending ledgend's Changes over websocket can be found in the ledserv repository.

A client implementation for esp8266 can be found in the ledgend-esp8266 repository.

Documentation

Overview

Package ledgend is a Go library aiming to provide a simple api for creating animations You can use to display on a LED strip.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	Direction          bool
	Start_pos, Length  float64 // float between 0 and 1
	Start_col, End_col Color
	Duration           time.Duration
	Start              time.Time
}

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func GenBuffer

func GenBuffer(length uint16) Buffer

GenBuffer generates an empty buffer

func (*Buffer) AddAnimation

func (b *Buffer) AddAnimation(a ...Animation)

AddAnimation adds an Animation to Buffer's animation queue

func (*Buffer) ApplyQueue

func (b *Buffer) ApplyQueue()

ApplyQueue applies every animation from Buffer's animation_queue in order

If the animation is finished, it removes it from the animation_queue

func (*Buffer) ClearQueue

func (b *Buffer) ClearQueue()

ClearQueue empties the buffer's animation_queue

func (*Buffer) GetAnimationQueue

func (b *Buffer) GetAnimationQueue() []Animation

GetAnimationQueue returns Buffer's animation queue

func (*Buffer) GetPixels

func (b *Buffer) GetPixels() []Color

GetPixels copies and returns pixels data from Buffer

type Change

type Change struct {
	Index uint16
	Pixel Color
}

func XORPixels

func XORPixels(p1 []Color, p2 []Color) ([]Change, error)

XORPixels returns Changes between Color slices

type Color

type Color struct {
	R, G, B uint8
}

func Gradient

func Gradient(a, b Color, m float64) Color

Gradient interpolates between two Colors at point m

m represents a float64 between 0 and 1

type SyncBuffer

type SyncBuffer struct {
	// contains filtered or unexported fields
}

func GenSyncBuffer

func GenSyncBuffer(length uint16) SyncBuffer

func (*SyncBuffer) AddAnimation

func (sb *SyncBuffer) AddAnimation(a ...Animation)

func (*SyncBuffer) ApplyQueue

func (sb *SyncBuffer) ApplyQueue()

func (*SyncBuffer) ClearQueue

func (sb *SyncBuffer) ClearQueue()

func (*SyncBuffer) GetAnimationQueue

func (sb *SyncBuffer) GetAnimationQueue() []Animation

func (*SyncBuffer) GetPixels

func (sb *SyncBuffer) GetPixels() []Color

Directories

Path Synopsis
Package animations provides preprogrammed animations You can use in github.com/franeklubi/ledgend! Example usage: buffer.AddAnimation(animations.FromMiddleFullSweep( ledgend.Color{5, 5, 5}, ledgend.Color{8, 8, 8}, time.Millisecond*1000, ))
Package animations provides preprogrammed animations You can use in github.com/franeklubi/ledgend! Example usage: buffer.AddAnimation(animations.FromMiddleFullSweep( ledgend.Color{5, 5, 5}, ledgend.Color{8, 8, 8}, time.Millisecond*1000, ))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL