rlottie

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

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 4 Imported by: 0

README

go-rlottie

Go Reference

Golang rlottie binding

See _example directory for examples.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLottieLoadFailed = errors.New("lottie load failed")
)

Functions

This section is empty.

Types

type Animation

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

func AnimationFromData

func AnimationFromData(data, key, rescourcePath string) (r Animation, err error)

AnimationFromData constructs an animation object from JSON string data. data, the JSON string data. key, the string that will be used to cache the JSON string data. resourcePath, the path that will be used to load external resource needed by the JSON data.

returns Animation object that can build the contents of the Lottie resource represented by JSON string data.

func AnimationFromFile

func AnimationFromFile(path string) (r Animation, err error)

AnimationFromFile constructs an animation object from file path. path, Lottie resource file path

returns Animation object that can build the contents of the Lottie resource represented by file path.

func (Animation) Destroy

func (a Animation) Destroy()

Destroy Animation object resource.

func (Animation) GetDuration

func (a Animation) GetDuration() float64

GetDuration returns total animation duration of Lottie resource in second. it uses totalFrame() and frameRate() to calculate the duration. duration = totalFrame() / frameRate()

func (Animation) GetFrameAtPos

func (a Animation) GetFrameAtPos(pos float64) uint

GetFrameAtPos maps position to frame number and returns it. pos, position in the range [ 0.0 .. 1.0 ]

func (Animation) GetFrameRate

func (a Animation) GetFrameRate() float64

GetFrameRate returns default framerate of the Lottie resource.

func (Animation) GetMarkerList

func (a Animation) GetMarkerList() (r []LOTMarker)

GetMarkerList returns list of markers in the Lottie resource LOTMarkerList has a `LOTMarker` list and size of list LOTMarker has the marker's name, start frame, and end frame.

func (Animation) GetSize

func (a Animation) GetSize() (d Dimension)

GetSize returns default viewport size of the Lottie reource.

func (Animation) GetTotalFrame

func (a Animation) GetTotalFrame() uint

GetTotalFrame returns total number of frames present in the Lottie resource.

func (Animation) PropertyOverride

func (a Animation) PropertyOverride(ptype int, keypath string, props ...float64)

PropertyOverride request to change properties of this animation object. type, property type. (Lottie_Animation_Property) keypath, specific content of target. props, ... property values.

func (Animation) Render

func (a Animation) Render(buf []uint32, frameNum, width, height, bytesPerLine uint) (rcast []uint8)

Render the content of the frame `frameNum` to `buf` frameNum, the frame number needs to be rendered. width, width of the surface height, height of the surface bytesPerLine, stride of the surface in bytes.

func (Animation) RenderAsync

func (a Animation) RenderAsync(buf []uint32, frameNum, width, height, bytesPerLine uint) (rcast []uint8)

RenderAsync render the content of the frame `frameNum` to `buf` asynchronously. frameNum, frame number needs to be rendered. width, width of the surface height, height of the surface bytesPerLine, stride of the surface in bytes.

func (Animation) RenderFlush

func (a Animation) RenderFlush() *C.uint

RenderFlush request to finish the current async renderer job for this animation object. If render is finished the this call returns immediately. If not, it waits till render job finish and then return.

warning: User must call `lottie_animation_render_async()` and `lottie_animation_render_flush()` in pair to get the benefit of async rendering.

returns pixel buffer it finished rendering.

func (Animation) RenderTree

func (a Animation) RenderTree(frameNum, width, height uint) (r *LOTLayerNode)

RenderTree get the render tree which contains the snapshot of the animation object at `frameNum`, the content of the animation in that frame number.

type Color

type Color struct {
	R, G, B, A uint8
}

type Dimension

type Dimension struct {
	Width  uint
	Height uint
}

type Gradient

type Gradient struct {
	Type                      int   // LOTGradientType
	Stop                      []int // LOTGradientStop
	Start, End, Center, Focal Point
	Cradius                   float64
	Fradius                   float64
}

type ImageInfo

type ImageInfo struct {
	Data          *uint8
	Width, Height uint
	Alpha         uint8
	Matrix        Matrix
}

type LOTLayerNode

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

func (*LOTLayerNode) Alpha

func (lln *LOTLayerNode) Alpha() uint8

func (*LOTLayerNode) ClipPath

func (lln *LOTLayerNode) ClipPath() (r Path)

func (*LOTLayerNode) KeyPath

func (lln *LOTLayerNode) KeyPath() string

func (*LOTLayerNode) LayerList

func (lln *LOTLayerNode) LayerList() (r []LOTLayerNode)

func (*LOTLayerNode) Mask

func (lln *LOTLayerNode) Mask() (r []LOTMask)

LOTLayerNode

func (*LOTLayerNode) Matte

func (lln *LOTLayerNode) Matte() int

func (*LOTLayerNode) NodeList

func (lln *LOTLayerNode) NodeList() (r []LOTNode)

func (*LOTLayerNode) Visible

func (lln *LOTLayerNode) Visible() int

type LOTMarker

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

func (*LOTMarker) EndFrame

func (lm *LOTMarker) EndFrame() uint

func (*LOTMarker) Name

func (lm *LOTMarker) Name() string

LOTMarker

func (*LOTMarker) StartFrame

func (lm *LOTMarker) StartFrame() uint

type LOTMask

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

func (*LOTMask) Alpha

func (lm *LOTMask) Alpha() uint8

func (*LOTMask) Mode

func (lm *LOTMask) Mode() int

LOTMask

func (*LOTMask) Path

func (lm *LOTMask) Path() (r Path)

type LOTNode

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

func (*LOTNode) BrushType

func (ln *LOTNode) BrushType() int

func (*LOTNode) Color

func (ln *LOTNode) Color() *Color

func (*LOTNode) FillRule

func (ln *LOTNode) FillRule() int

func (*LOTNode) Flag

func (ln *LOTNode) Flag() int

func (*LOTNode) Gradient

func (ln *LOTNode) Gradient() (r *Gradient)

func (*LOTNode) ImageInfo

func (ln *LOTNode) ImageInfo() (r *ImageInfo)

func (*LOTNode) KeyPath

func (ln *LOTNode) KeyPath() string

func (*LOTNode) Path

func (ln *LOTNode) Path() (r Path)

LOTNode

func (*LOTNode) Stroke

func (ln *LOTNode) Stroke() (r *Stroke)

type Lottie_Animation_Property

type Lottie_Animation_Property = C.Lottie_Animation_Property

type Lottie_Animation_S

type Lottie_Animation_S = C.struct_Lottie_Animation_S

type Matrix

type Matrix struct {
	M11, M12, M13 float64
	M21, M22, M23 float64
	M31, M32, M33 float64
}

type Path

type Path struct {
	Pt  []float64
	Elm []string
}

type Point

type Point struct {
	X, Y float64
}

type Stroke

type Stroke struct {
	Enable     uint8
	Width      float64
	Cap        int // LOTCapStyle
	Join       int // LOTJoinStyle
	MiterLimit float64
	DashArray  []float64
}

Directories

Path Synopsis
_example

Jump to

Keyboard shortcuts

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