time

package
v0.0.0-...-50cf7ee Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration struct {
	F float64
	U Unit
}

func ParseDuration

func ParseDuration(s string) (Duration, error)

func (Duration) Convert

func (v Duration) Convert(to Unit) Duration

func (Duration) Frames

func (v Duration) Frames(fps float64) float64

Frames returns the value in frames based on a specific timestamp

func (Duration) IsZero

func (v Duration) IsZero() bool

func (Duration) String

func (v Duration) String() string

type Iterator

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

Iterator is returned by TimeCode for advancing it for a set period. Each call to Next() will advance the TimeCode.

func (*Iterator) HasNext

func (i *Iterator) HasNext() bool

func (*Iterator) Next

func (i *Iterator) Next() interface{}

type Span

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

func (Span) Add

func (s Span) Add(b Span, fps int) Span

Add adds two spans together so the returned one includes both.

func (Span) ApplyFPS

func (s Span) ApplyFPS(fps int) Span

func (Span) Clear

func (s Span) Clear() Span

Clear returns a Span which starts where this one does but ends at the same position. Duration will be reset but set to the same unit as the source.

func (Span) ContainsFrame

func (s Span) ContainsFrame(frame int) bool

func (Span) Duration

func (s Span) Duration() Duration

func (Span) End

func (s Span) End() int

func (Span) Length

func (s Span) Length() int

func (Span) Move

func (s Span) Move(ns int) Span

func (Span) Range

func (s Span) Range() (int, int)

func (Span) Start

func (s Span) Start() int

type TimeCode

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

TimeCode handles the management of Timecodes during an animation

func NewTimeCode

func NewTimeCode(frameRate int) *TimeCode

NewTimeCode creates a TimeCode with the specified frame rate

func ReadTimeCode

func ReadTimeCode(r io.Reader) (TimeCode, error)

func (*TimeCode) ForFrames

func (tc *TimeCode) ForFrames(count int) *Iterator

func (*TimeCode) FrameNum

func (tc *TimeCode) FrameNum() int

FrameNum is the overall frame number, starting at 1. This can be used when forming file names for individual frame images

func (*TimeCode) FrameRate

func (tc *TimeCode) FrameRate() int

FrameRate returns the frame rate of the clip

func (*TimeCode) FrameRateF

func (tc *TimeCode) FrameRateF() float64

func (*TimeCode) IsRunning

func (tc *TimeCode) IsRunning() bool

IsRunning returns true if the TimeCode is running. Specifically once a frame has been rendered it is running.

func (*TimeCode) Next

func (tc *TimeCode) Next()

Next moves the TimeCode to the next frame.

func (*TimeCode) Set

func (tc *TimeCode) Set(s string) (*TimeCode, error)

Set sets the starting TimeCode. This is in the format "hh:mm:ss:ff" although a short form "hh:mm:ss" is valid in which case ff will be 0.

This will return an error if the TimeCode has been used for a frame, e.g. Next() has been called.

func (*TimeCode) StartTimeCode

func (tc *TimeCode) StartTimeCode() TimeCodeFragment

StartTimeCode returns the time code of the first frame

func (*TimeCode) TimeCode

func (tc *TimeCode) TimeCode() TimeCodeFragment

TimeCode returns the time code for the current frame

func (*TimeCode) Until

func (tc *TimeCode) Until(s string) (*Iterator, error)

func (*TimeCode) Write

func (tc *TimeCode) Write(w io.Writer) error

type TimeCodeFragment

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

func ParseTimeCode

func ParseTimeCode(s string, frameRate int) (TimeCodeFragment, error)

func ReadTimeCodeFragment

func ReadTimeCodeFragment(r io.Reader) (TimeCodeFragment, error)

func (TimeCodeFragment) Add

func (tc TimeCodeFragment) Add(d, h, m, s, f int) TimeCodeFragment

func (TimeCodeFragment) AddFrames

func (tc TimeCodeFragment) AddFrames(count int) TimeCodeFragment

func (TimeCodeFragment) After

func (TimeCodeFragment) Before

func (tc TimeCodeFragment) Before(b TimeCodeFragment) bool

func (TimeCodeFragment) Day

func (tc TimeCodeFragment) Day() int

func (TimeCodeFragment) DayF

func (tc TimeCodeFragment) DayF() float64

func (TimeCodeFragment) DayS

func (tc TimeCodeFragment) DayS() string

DayS returns the hour component as a 2 digit string, useful in rendering

func (TimeCodeFragment) Equals

func (tc TimeCodeFragment) Equals(b TimeCodeFragment) bool

func (TimeCodeFragment) Frame

func (tc TimeCodeFragment) Frame() int

Frame returns the frame within the current second

func (TimeCodeFragment) FrameF

func (tc TimeCodeFragment) FrameF() float64

func (TimeCodeFragment) FrameRate

func (tc TimeCodeFragment) FrameRate() int

FrameRate of the clip

func (TimeCodeFragment) FrameRateF

func (tc TimeCodeFragment) FrameRateF() float64

func (TimeCodeFragment) FrameS

func (tc TimeCodeFragment) FrameS() string

FrameS returns the frame component as a 2 digit string, useful in rendering

func (TimeCodeFragment) FramesRemaining

func (tc TimeCodeFragment) FramesRemaining() int

FramesRemaining returns the number of frames remaining in the current second. This is simply frameRate - frame.

func (TimeCodeFragment) Hour

func (tc TimeCodeFragment) Hour() int

Hour returns the hour component as an int

func (TimeCodeFragment) HourF

func (tc TimeCodeFragment) HourF() float64

func (TimeCodeFragment) HourS

func (tc TimeCodeFragment) HourS() string

HourS returns the hour component as a 2 digit string, useful in rendering

func (TimeCodeFragment) IsStartSecond

func (tc TimeCodeFragment) IsStartSecond() bool

IsStartSecond returns true if the current frame is the first of a whole second.

func (TimeCodeFragment) Minute

func (tc TimeCodeFragment) Minute() int

Minute returns the minute component as an int

func (TimeCodeFragment) MinuteF

func (tc TimeCodeFragment) MinuteF() float64

func (TimeCodeFragment) MinuteS

func (tc TimeCodeFragment) MinuteS() string

MinuteS returns the minute component as a 2 digit string, useful in rendering

func (TimeCodeFragment) NotAfter

func (tc TimeCodeFragment) NotAfter(b TimeCodeFragment) bool

func (TimeCodeFragment) Offset

func (tc TimeCodeFragment) Offset() int

Offset returns the number of seconds since "00:00:00" for the clip

func (TimeCodeFragment) Second

func (tc TimeCodeFragment) Second() int

Second returns the second component as an int

func (TimeCodeFragment) SecondF

func (tc TimeCodeFragment) SecondF() float64

func (TimeCodeFragment) SecondS

func (tc TimeCodeFragment) SecondS() string

SecondS returns the second component as a 2 digit string, useful in rendering

func (TimeCodeFragment) TimeCode

func (tc TimeCodeFragment) TimeCode() string

func (TimeCodeFragment) Write

func (tc TimeCodeFragment) Write(w io.Writer) error

type Unit

type Unit uint8
const (
	Second Unit = iota
	Minute
	Hour
	Day
)

func (Unit) SecondsPer

func (u Unit) SecondsPer() float64

func (Unit) String

func (u Unit) String() string

Jump to

Keyboard shortcuts

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