layer

package
v0.0.0-...-097d1aa Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package layer represents a lottie layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image interface {
	Type() Type
}

Image represents a lottie image layer.

type ImageT

type ImageT struct {

	// Auto-Orient along path AE property.
	AutoOrient *int `json:"ao,omitempty"`

	// Blend Mode
	BlendMode *int `json:"bm,omitempty"`

	// Parsed layer name used as html class on SVG/HTML renderer
	Class *string `json:"cl,omitempty"`

	// 3D layer flag
	Ddd *int `json:"ddd,omitempty"`

	// List of Effects
	Effects []json.RawMessage `json:"ef,omitempty"`

	// Boolean when layer has a mask. Will be deprecated in favor of checking maskProperties.
	HasMask *bool `json:"hasMask,omitempty"`

	// Layer index in AE. Used for parenting and expressions.
	Inded *int `json:"ind,omitempty"`

	// In Point of layer. Sets the initial frame of the layer.
	InPoint *float64 `json:"ip,omitempty"`

	// Transform properties
	Transform *helpers.Transform `json:"ks,omitempty"`

	// Parsed layer name used as html id on SVG/HTML renderer
	LayerName *string `json:"ln,omitempty"`

	// List of Masks
	MaskProperties []json.RawMessage `json:"maskProperties,omitempty"`

	// After Effects Layer Name. Used for expressions.
	Name *string `json:"nm,omitempty"`

	// Out Point of layer. Sets the final frame of the layer.
	OutPoint *float64 `json:"op,omitempty"`

	// Layer Parent. Uses ind of parent.
	Parent *int `json:"parent,omitempty"`

	// RefID pointing to the source image defined on 'assets' object
	RefID *string `json:"refId,omitempty"`

	// Layer Time Stretching
	TimeStretching *float64 `json:"sr,omitempty"`

	// Start Time of layer. Sets the start time of the layer.
	StartTime *float64 `json:"st,omitempty"`

	// Type of layer: Image.
	Ty Type `json:"ty,omitempty"`
}

ImageT implements the Image and Layer interface.

func (*ImageT) GetAutoOrient

func (i *ImageT) GetAutoOrient() int

GetAutoOrient returns the AutoOrient field if it's non-nil, zero value otherwise.

func (*ImageT) GetBlendMode

func (i *ImageT) GetBlendMode() int

GetBlendMode returns the BlendMode field if it's non-nil, zero value otherwise.

func (*ImageT) GetClass

func (i *ImageT) GetClass() string

GetClass returns the Class field if it's non-nil, zero value otherwise.

func (*ImageT) GetDdd

func (i *ImageT) GetDdd() int

GetDdd returns the Ddd field if it's non-nil, zero value otherwise.

func (*ImageT) GetHasMask

func (i *ImageT) GetHasMask() bool

GetHasMask returns the HasMask field if it's non-nil, zero value otherwise.

func (*ImageT) GetInPoint

func (i *ImageT) GetInPoint() float64

GetInPoint returns the InPoint field if it's non-nil, zero value otherwise.

func (*ImageT) GetInded

func (i *ImageT) GetInded() int

GetInded returns the Inded field if it's non-nil, zero value otherwise.

func (*ImageT) GetLayerName

func (i *ImageT) GetLayerName() string

GetLayerName returns the LayerName field if it's non-nil, zero value otherwise.

func (*ImageT) GetName

func (i *ImageT) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*ImageT) GetOutPoint

func (i *ImageT) GetOutPoint() float64

GetOutPoint returns the OutPoint field if it's non-nil, zero value otherwise.

func (*ImageT) GetParent

func (i *ImageT) GetParent() int

GetParent returns the Parent field if it's non-nil, zero value otherwise.

func (*ImageT) GetRefID

func (i *ImageT) GetRefID() string

GetRefID returns the RefID field if it's non-nil, zero value otherwise.

func (*ImageT) GetStartTime

func (i *ImageT) GetStartTime() float64

GetStartTime returns the StartTime field if it's non-nil, zero value otherwise.

func (*ImageT) GetTimeStretching

func (i *ImageT) GetTimeStretching() float64

GetTimeStretching returns the TimeStretching field if it's non-nil, zero value otherwise.

func (*ImageT) GetTransform

func (i *ImageT) GetTransform() *helpers.Transform

GetTransform returns the shape's transform.

func (*ImageT) Type

func (s *ImageT) Type() Type

Type returns the layer type.

type Layer

type Layer interface {
	// GetTransform returns the shape's transform.
	GetTransform() *helpers.Transform

	// Type returns the layer's type.
	Type() Type
}

Layer represents a lottie layer.

func New

func New(buf json.RawMessage) Layer

New uses reflection to return a Layer.

type Null

type Null interface {
	Type() Type
}

Null represents a lottie null layer.

type NullT

type NullT struct {
	// Auto-Orient along path AE property.
	AutoOrient *int `json:"ao,omitempty"`

	// Parsed layer name used as html class on SVG/HTML renderer
	Class *string `json:"cl,omitempty"`

	// 3D layer flag
	Ddd *int `json:"ddd,omitempty"`

	// List of Effects
	Effects []json.RawMessage `json:"ef,omitempty"`

	// Layer index in AE. Used for parenting and expressions.
	Ind *int `json:"ind,omitempty"`

	// In Point of layer. Sets the initial frame of the layer.
	InPoint *float64 `json:"ip,omitempty"`

	// Transform properties
	Transform *helpers.Transform `json:"ks,omitempty"`

	// Parsed layer name used as html id on SVG/HTML renderer
	LayerName *string `json:"ln,omitempty"`

	// After Effects Layer Name. Used for expressions.
	Name *float64 `json:"nm,omitempty"`

	// Out Point of layer. Sets the final frame of the layer.
	OutPoint *float64 `json:"op,omitempty"`

	// Layer Parent. Uses ind of parent.
	Parent *int `json:"parent,omitempty"`

	// Layer Time Stretching
	TimeStretching *float64 `json:"sr,omitempty"`

	// Start Time of layer. Sets the start time of the layer.
	StartTime *float64 `json:"st,omitempty"`

	// Type of layer: Null.
	Ty Type `json:"ty,omitempty"`
}

NullT implements the Null and Layer interface.

func (*NullT) GetAutoOrient

func (n *NullT) GetAutoOrient() int

GetAutoOrient returns the AutoOrient field if it's non-nil, zero value otherwise.

func (*NullT) GetClass

func (n *NullT) GetClass() string

GetClass returns the Class field if it's non-nil, zero value otherwise.

func (*NullT) GetDdd

func (n *NullT) GetDdd() int

GetDdd returns the Ddd field if it's non-nil, zero value otherwise.

func (*NullT) GetInPoint

func (n *NullT) GetInPoint() float64

GetInPoint returns the InPoint field if it's non-nil, zero value otherwise.

func (*NullT) GetInd

func (n *NullT) GetInd() int

GetInd returns the Ind field if it's non-nil, zero value otherwise.

func (*NullT) GetLayerName

func (n *NullT) GetLayerName() string

GetLayerName returns the LayerName field if it's non-nil, zero value otherwise.

func (*NullT) GetName

func (n *NullT) GetName() float64

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*NullT) GetOutPoint

func (n *NullT) GetOutPoint() float64

GetOutPoint returns the OutPoint field if it's non-nil, zero value otherwise.

func (*NullT) GetParent

func (n *NullT) GetParent() int

GetParent returns the Parent field if it's non-nil, zero value otherwise.

func (*NullT) GetStartTime

func (n *NullT) GetStartTime() float64

GetStartTime returns the StartTime field if it's non-nil, zero value otherwise.

func (*NullT) GetTimeStretching

func (n *NullT) GetTimeStretching() float64

GetTimeStretching returns the TimeStretching field if it's non-nil, zero value otherwise.

func (*NullT) GetTransform

func (n *NullT) GetTransform() *helpers.Transform

GetTransform returns the shape's transform.

func (*NullT) Type

func (n *NullT) Type() Type

Type returns the layer type.

type PreComp

type PreComp interface {
	// GetTransform returns the shape's transform.
	GetTransform() *helpers.Transform

	// Type returns PreCompType.
	Type() Type
}

PreComp represents a lottie preComp layer.

type PreCompT

type PreCompT struct {
	// Auto-Orient along path AE property.
	AutoOrient *int `json:"ao,omitempty"`

	// Blend Mode
	BlendMode *int `json:"bm,omitempty"`

	// Parsed layer name used as html class on SVG/HTML renderer
	Class *string `json:"cl,omitempty"`

	// 3D layer flag
	Ddd *int `json:"ddd,omitempty"`

	// List of Effects
	Effects []json.RawMessage `json:"ef,omitempty"`

	// Boolean when layer has a mask. Will be deprecated in favor of checking maskProperties.
	HasMask *bool `json:"hasMask,omitempty"`

	// Layer index in AE. Used for parenting and expressions.
	Index *int `json:"ind,omitempty"`

	// In Point of layer. Sets the initial frame of the layer.
	InPoint *float64 `json:"ip,omitempty"`

	// Transform properties
	Transform *helpers.Transform `json:"ks,omitempty"`

	// Parsed layer name used as html id on SVG/HTML renderer
	LayerName *string `json:"ln,omitempty"`

	// List of Masks
	MaskProperties []json.RawMessage `json:"maskProperties,omitempty"`

	// After Effects Layer Name. Used for expressions.
	Name *string `json:"nm,omitempty"`

	// Out Point of layer. Sets the final frame of the layer.
	OutPoint *float64 `json:"op,omitempty"`

	// Layer Parent. Uses ind of parent.
	Parent *int `json:"parent,omitempty"`

	// RefID pointing to the source composition defined on 'assets' object
	RefID *string `json:"refId,omitempty"`

	// Layer Time Stretching
	TimeStretching *float64 `json:"sr,omitempty"`

	// Start Time of layer. Sets the start time of the layer.
	StartTime *float64 `json:"st,omitempty"`

	// Comp's Time remapping
	TimeMapping *float64 `json:"tm,omitempty"`

	// Type of layer: Precomp.
	Ty Type `json:"ty,omitempty"`
}

PreCompT implements the PreComp and Layer interface.

func (*PreCompT) GetAutoOrient

func (p *PreCompT) GetAutoOrient() int

GetAutoOrient returns the AutoOrient field if it's non-nil, zero value otherwise.

func (*PreCompT) GetBlendMode

func (p *PreCompT) GetBlendMode() int

GetBlendMode returns the BlendMode field if it's non-nil, zero value otherwise.

func (*PreCompT) GetClass

func (p *PreCompT) GetClass() string

GetClass returns the Class field if it's non-nil, zero value otherwise.

func (*PreCompT) GetDdd

func (p *PreCompT) GetDdd() int

GetDdd returns the Ddd field if it's non-nil, zero value otherwise.

func (*PreCompT) GetHasMask

func (p *PreCompT) GetHasMask() bool

GetHasMask returns the HasMask field if it's non-nil, zero value otherwise.

func (*PreCompT) GetInPoint

func (p *PreCompT) GetInPoint() float64

GetInPoint returns the InPoint field if it's non-nil, zero value otherwise.

func (*PreCompT) GetIndex

func (p *PreCompT) GetIndex() int

GetIndex returns the Index field if it's non-nil, zero value otherwise.

func (*PreCompT) GetLayerName

func (p *PreCompT) GetLayerName() string

GetLayerName returns the LayerName field if it's non-nil, zero value otherwise.

func (*PreCompT) GetName

func (p *PreCompT) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*PreCompT) GetOutPoint

func (p *PreCompT) GetOutPoint() float64

GetOutPoint returns the OutPoint field if it's non-nil, zero value otherwise.

func (*PreCompT) GetParent

func (p *PreCompT) GetParent() int

GetParent returns the Parent field if it's non-nil, zero value otherwise.

func (*PreCompT) GetRefID

func (p *PreCompT) GetRefID() string

GetRefID returns the RefID field if it's non-nil, zero value otherwise.

func (*PreCompT) GetStartTime

func (p *PreCompT) GetStartTime() float64

GetStartTime returns the StartTime field if it's non-nil, zero value otherwise.

func (*PreCompT) GetTimeMapping

func (p *PreCompT) GetTimeMapping() float64

GetTimeMapping returns the TimeMapping field if it's non-nil, zero value otherwise.

func (*PreCompT) GetTimeStretching

func (p *PreCompT) GetTimeStretching() float64

GetTimeStretching returns the TimeStretching field if it's non-nil, zero value otherwise.

func (*PreCompT) GetTransform

func (p *PreCompT) GetTransform() *helpers.Transform

GetTransform returns the shape's transform.

func (*PreCompT) Type

func (p *PreCompT) Type() Type

Type returns the layer type.

type Shape

type Shape interface {
	// GetIndex returns the shape index.
	GetIndex() int

	// GetName returns the shape name.
	GetName() string

	// GetShapes returns the list of shape items.
	GetShapes() []ls.Shape

	// GetTransform returns the shape's transform.
	GetTransform() *helpers.Transform

	// Type returns ShapeType.
	Type() Type
}

Shape represents a lottie shape layer.

type ShapeT

type ShapeT struct {

	// Auto-Orient along path AE property.
	AutoOrient *int `json:"ao,omitempty"`

	// Blend Mode
	BlendMode *int `json:"bm,omitempty"`

	// Parsed layer name used as html class on SVG/HTML renderer
	Class *string `json:"cl,omitempty"`

	// 3d layer flag
	Ddd *int `json:"ddd,omitempty"`

	// List of Effects
	Effects []json.RawMessage `json:"ef,omitempty"`

	// Boolean when layer has a mask. Will be deprecated in favor of checking maskProperties.
	HasMask *bool `json:"hasMask,omitempty"`

	// Layer index in AE. Used for parenting and expressions.
	Index *int `json:"ind,omitempty"`

	// In Point of layer. Sets the initial frame of the layer.
	InPoint *float64 `json:"ip,omitempty"`

	// Shape list of items.
	Shapes []json.RawMessage `json:"shapes,omitempty"`

	// Transform properties
	Transform *helpers.Transform `json:"ks,omitempty"`

	// Parsed layer name used as html id on SVG/HTML renderer
	LayerName *string `json:"ln,omitempty"`

	// List of Masks
	MaskProperties []json.RawMessage `json:"maskProperties,omitempty"`

	// After Effects Layer Name. Used for expressions.
	Name *string `json:"nm,omitempty"`

	// Out Point of layer. Sets the final frame of the layer.
	OutPoint *float64 `json:"op,omitempty"`

	// Layer Parent. Uses ind of parent.
	Parent *int `json:"parent,omitempty"`

	// Layer Time Stretching
	TimeStretching *float64 `json:"sr,omitempty"`

	// Start Time of layer. Sets the start time of the layer.
	StartTime *float64 `json:"st,omitempty"`

	// Type of layer: Shape.
	Ty Type `json:"ty,omitempty"`
}

ShapeT implements the Shape and Layer interface.

func (*ShapeT) GetAutoOrient

func (s *ShapeT) GetAutoOrient() int

GetAutoOrient returns the AutoOrient field if it's non-nil, zero value otherwise.

func (*ShapeT) GetBlendMode

func (s *ShapeT) GetBlendMode() int

GetBlendMode returns the BlendMode field if it's non-nil, zero value otherwise.

func (*ShapeT) GetClass

func (s *ShapeT) GetClass() string

GetClass returns the Class field if it's non-nil, zero value otherwise.

func (*ShapeT) GetDdd

func (s *ShapeT) GetDdd() int

GetDdd returns the Ddd field if it's non-nil, zero value otherwise.

func (*ShapeT) GetHasMask

func (s *ShapeT) GetHasMask() bool

GetHasMask returns the HasMask field if it's non-nil, zero value otherwise.

func (*ShapeT) GetInPoint

func (s *ShapeT) GetInPoint() float64

GetInPoint returns the InPoint field if it's non-nil, zero value otherwise.

func (*ShapeT) GetIndex

func (s *ShapeT) GetIndex() int

GetIndex returns the Index field if it's non-nil, zero value otherwise.

func (*ShapeT) GetLayerName

func (s *ShapeT) GetLayerName() string

GetLayerName returns the LayerName field if it's non-nil, zero value otherwise.

func (*ShapeT) GetName

func (s *ShapeT) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*ShapeT) GetOutPoint

func (s *ShapeT) GetOutPoint() float64

GetOutPoint returns the OutPoint field if it's non-nil, zero value otherwise.

func (*ShapeT) GetParent

func (s *ShapeT) GetParent() int

GetParent returns the Parent field if it's non-nil, zero value otherwise.

func (*ShapeT) GetShapes

func (s *ShapeT) GetShapes() (result []ls.Shape)

GetShapes returns the shapes casted to their appropriate types.

func (*ShapeT) GetStartTime

func (s *ShapeT) GetStartTime() float64

GetStartTime returns the StartTime field if it's non-nil, zero value otherwise.

func (*ShapeT) GetTimeStretching

func (s *ShapeT) GetTimeStretching() float64

GetTimeStretching returns the TimeStretching field if it's non-nil, zero value otherwise.

func (*ShapeT) GetTransform

func (s *ShapeT) GetTransform() *helpers.Transform

GetTransform returns the shape's transform.

func (*ShapeT) Type

func (s *ShapeT) Type() Type

Type returns the layer type.

type Type

type Type int

Type identifies the type of lottie layer.

const (
	// ImageType is a lottie image layer.
	ImageType Type = 2
)
const (
	// NullType is a lottie null layer.
	NullType Type = 3
)
const (
	// PreCompType is a lottie preComp layer.
	PreCompType Type = 0
)
const (
	// ShapeType is a lottie shape layer.
	ShapeType Type = 4
)

Jump to

Keyboard shortcuts

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