timer

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timer

type Timer struct {
	Progress, Period float64
}

Timer measures a elapsed time, its very simple but effective

func Period

func Period(period float64) Timer

Period returns timer with given period

func Progress

func Progress(progress float64, period float64) Timer

Progress returns timer with given progress and period

func Random

func Random(period float64) Timer

func (Timer) Done

func (t Timer) Done() bool

Done returns whether progress exceeded period

func (*Timer) DoneReset

func (t *Timer) DoneReset() bool

DoneReset returns true and resets the timer

func (*Timer) Reset

func (t *Timer) Reset()

Reset sets progres to 0

func (*Timer) Skip added in v0.3.8

func (t *Timer) Skip()

Skip skips timer cycle

func (*Timer) Tick

func (t *Timer) Tick(delta float64)

Tick increases progress by delta

func (*Timer) TickDone

func (t *Timer) TickDone(delta float64) bool

TickDone does Tick and Done in one step

func (*Timer) TickDoneReset

func (t *Timer) TickDoneReset(delta float64) bool

TickDoneReset does tick and if Done that it resets

Jump to

Keyboard shortcuts

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