Documentation ¶
Index ¶
- func Import(ctx context.Context, input ImportInput) (*pb.AtlasFile, error)
- type AnimDirection
- type AnimEventIO
- type Animation
- type AnimationClip
- type AsepriteInput
- type AtlasImporter
- type AtlasImporterGroup
- type File
- func (f *File) GetFrameByIndex(index int) (i FrameInfo, ok bool)
- func (f *File) GetFrameByName(name string) (i FrameInfo, ok bool)
- func (f *File) GetMetadata() Metadata
- func (f *File) GetSliceByName(name string) (slc Slice, index int)
- func (f *File) Length() int
- func (f *File) Walk(fn func(i FrameInfo) bool)
- type FrameIO
- type FrameInfo
- type FrameRect
- type FrameTag
- type ImSize
- type ImportInput
- type Layer
- type Metadata
- type Slice
- type SliceKeyframe
- type Vec2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnimDirection ¶
type AnimDirection string
AnimDirection represents Aseprite animation directions
const ( // AnimForward forward animation AnimForward AnimDirection = "forward" // AnimReverse reverse animation AnimReverse AnimDirection = "reverse" // AnimPingPong goes forward and backwards endlessly AnimPingPong AnimDirection = "pingpong" )
type AnimEventIO ¶
type Animation ¶
type Animation struct { Name string `json:"name"` Clips []AnimationClip `json:"clips"` }
type AnimationClip ¶
type AnimationClip struct { Name string `json:"name"` ClipMode string `json:"clip_mode,omitempty"` Frames []string `json:"frames,omitempty"` Events []AnimEventIO `json:"events"` EndedEvent *AnimEventIO `json:"ended_event,omitempty"` FPS int `json:"fps"` }
type AsepriteInput ¶
type AtlasImporter ¶
type AtlasImporter struct { Frames []FrameIO `json:"frames"` AsepriteSheet string `json:"asesprite_sheet"` ExportUndefinedFrames bool `json:"export_undefined_frames"` }
AtlasImporter is a template used to import an Aseprite JSON (of a sprite sheet) to Primen.
func (AtlasImporter) FrameWithFilename ¶
func (i AtlasImporter) FrameWithFilename(filename string) (frame FrameIO, exists bool)
FrameWithFilename returns the frame with the specified filename.
type AtlasImporterGroup ¶
type AtlasImporterGroup struct { Templates []AtlasImporter `json:"templates"` Output string `json:"output,omitempty"` ImageFilter string `json:"image_filter,omitempty"` MaxWidth int `json:"max_width"` MaxHeight int `json:"max_height"` Padding int `json:"padding"` Animations []Animation `json:"animations"` Clips []AnimationClip `json:"clips,omitempty"` }
AtlasImporterGroup is the root of an import template
type File ¶
File represents an Aseprite sprite sheet file
func Parse ¶
Parse an Aseprite sheet JSON file. Warning: export frams as ARRAY. Do not use the Map option. JSON maps are not guaranteed to be ordered, and Primen is made in Go, which doesn't preserve the order of a Map. The JSON spec states that relying on key ordered maps is abad idea. https://github.com/golang/go/issues/27179#issuecomment-415525033
func (*File) GetFrameByIndex ¶
GetFrameByIndex returns the FrameInfo at the index position. It returns false if out of bounds.
func (*File) GetFrameByName ¶
GetFrameByName returns the FrameInfo with the specified name.
func (*File) GetMetadata ¶
GetMetadata retrieves Aseprite metadata
type FrameIO ¶
type FrameIO struct { Filename string `json:"filename"` Pivot Vec2 `json:"pivot,omitempty"` //TODO: use }
FrameIO is the template to import a sprite by the frame itself. This is used when the import strategy is set to Frames, or when it is set to Default and no frame tags or slices are available.
type FrameTag ¶
type FrameTag struct { Name string `json:"name"` From int `json:"from"` To int `json:"to"` Direction AnimDirection `json:"direction"` }
"name": "lbar1", "from": 0, "to": 11, "direction": "forward"
type ImportInput ¶
type ImportInput struct { Template *AtlasImporterGroup Source []AsepriteInput PackerI atlaspacker.PackerInput }
type Metadata ¶
type Metadata struct { App string `json:"app"` Version string `json:"version"` Image string `json:"image"` Format string `json:"format"` Size ImSize `json:"size,omitempty"` Scale string `json:"scale"` FrameTags []FrameTag `json:"frameTags"` Layers []Layer `json:"layers,omitempty"` Slices []Slice `json:"slices"` }
type Slice ¶
type Slice struct { Name string `json:"name"` Color string `json:"color"` Keys []SliceKeyframe `json:"keys"` }