# Acnl
A class
representing an Animal Crossing New Leaf in-game pattern.
- Extends:
AcPattern
# Constructor
Instantiates an Acnl.
- Arguments
acnl
- Type:
Acnl
- Type:
# Instance Accessors
# title
The title of the Acnl.
get
- Type:
string
- Default:
""
- Type:
set
- Type:
string
- Note: limited to 20 characters
- Type:
# villagerId
The id of the villager. Needs to be equal to in-game villagerId
for pattern to be editable.
get
- Type:
number
- Default:
0
- Type:
set
- Type:
number
- Note: limited to unsigned 16 bit values
- Type:
# villagerName
The name of the villager.
get
- Type:
string
- Default:
""
- Type:
set
- Type:
string
- Note: limited to 8 characters
- Type:
# villagerIsFemale
The gender flag of the villager.
get
- Type:
boolean
- Default:
false
- Type:
set
- Type:
boolean
- Type:
# townId
The id of the town. Needs to be equal to in-game townId
for pattern to be editable.
get
- Type:
number
- Default:
0
- Type:
set
- Type:
number
- Note: limited to unsigned 16 bit values
- Type:
# townName
The name of the town.
get
- Type:
string
- Default:
""
- Type:
set
- Type:
string
- Note: limited to 8 characters
- Type:
# type
The type of the pattern (e.g. Standard, Shirt, Dress, etc.)
get
- Type:
PatternType
- Default:
Acnl.types.Standard
- Type:
set
- Type:
PatternType
- Type:
# palette
A mapping for rendering colors.
# pixels
The arrangement of the pixels as a pixel grid, includes unused pixels.
get
- Type:
PixelsSource
- Default:
new PixelsSource(32, 128)
- Type:
# sections
The different possible access mappings of the pattern.
get
- Type:
Object
- Properties:
texture
- Type:
PixelsSource
- Type:
[key: string]
- Type:
PixelsSource
- Type:
- Type:
# hooks
The hook system for subscribing to and triggering events.
get
- Type:
Object
- Properties:
type
:- Type:
Hook<[PatternType]>
;
- Type:
palette
- Type:
Hook<[number,
color
]>
;
- Type:
load
- Type:
Hook<[]>
;
- Type:
refresh
- Type:
Hook<[]>
;
- Type:
- Type:
# Instance Methods
# toBinaryString
Creates a formatted binary string from an Acnl.
- Returns
- Type:
string
- Type:
# fromBinaryString
Loads data into the Acnl from a formatted binary string.
- Arguments
binaryString
required- Type:
string
- Type:
- Returns
- Type:
Acnl
- Type:
# toQRCodes
Creates QR Code images for the Acnl.
It creates the most minimal qr code images possible. If you need to scale up
the image to create downloads for it, use a canvas and make sure to do context.imageSmoothingEnabled=false
;
If you plan on scaling it for display via CSS, use image-rendering: pixelated
to tell the browser to keep the sharpness of the original image.
- Returns
- Type:
Promise<Array<HTMLImageElement>>
- Type:
# fromQRCodes
Decodes 1 whole or 4 multipart QR codes to construct an Acnl from the images. If there are multiple Acnls encoded in the images, loads the first it can decode.
- Arguments
images
- Type:
Array<HTMLImageElement>
- Type:
- Returns
- Type:
Promise<
Acnl
>
- Type:
# Static Properties
# types
The pattern type this format instance is using e.g. Standard, Shirt, Hat, etc.
- Type:
Object
- Properties:
LongSleevedDress
- Type:
PixelsSource
- Type:
ShortSleevedDress
- Type:
PixelsSource
- Type:
NoSleevedDress
- Type:
PixelsSource
- Type:
LongSleevedShirt
- Type:
PixelsSource
- Type:
ShortSleevedShirt
- Type:
PixelsSource
- Type:
NoSleevedShirt
- Type:
PixelsSource
- Type:
HornedHat
- Type:
PixelsSource
- Type:
KnittedHat
- Type:
PixelsSource
- Type:
Standee
- Type:
PixelsSource
- Type:
Standard
- Type:
PixelsSource
- Type:
# colors
The set of colors in the Acnl colorspace.
- Type:
Set<
color
>
# colorToByte
The color to byte mappings, used to convert colors to byte values.
- Type:
Map<
color
, byte>
# byteToColor
The byte to color mappings, used to convert bytes to colors.
- Type:
Map<byte,
color
>
# Static Methods
# nearestColorInColorSpace
Translates the inputColor to the closest available hex color in the space.
# toBinaryString
Creates a formatted binary string from an Acnl.
- Arguments
acnl
required- Type:
Acnl
- Type:
- Returns
- Type:
string
- Type:
# fromBinaryString
Creates an Acnl from a formatted binary string.
- Arguments
binaryString
required- Type:
string
- Type:
- Returns
- Type:
Acnl
- Type:
# toQRCodes
Creates QR Code images for the Acnl.
- Arguments
acnl
required- Type:
Acnl
- Type:
- Returns
- Type:
Promise<Array<HTMLImageElement>>
- Type:
# fromQRCodes
Constructs an acnl from QR Codes.
- Arguments
images
required- Type:
Array<HTMLImageElement>
- Type:
- Returns
- Type:
Promise<
Acnl
>
- Type:
# readQRCodes
Decodes QR Codes to construct Acnls from the QR Codes in the images.
The image must be sufficiently sharp enough to read the QR codes. Compressed image formats (like jpeg) are more likely to fail because they introduce noise.
- Arguments
images
required- Type:
Array<HTMLImageElement>
- Type:
- Returns
- Type:
Promise<Array<
Acnl
>>
- Type: