1.1.1 2D Preview Template
This is the display template for 2D Inscriptions engraving. This template serves as a sample reference that can be directly used. You can also modify its source code for customization, or write a new template according to your needs and upload it to the blockchain.
The on-chain inscription script for this template is
You can view its related source code or directly reference it. Related rules are described below.
Example:
We will use the last animation resource of 2D Inscriptions as an example to provide a detailed explanation of the attributes of this 2D Preview Template:
Preview display-related attributes are included within the <metaversepreview> block of attributes. Single basic attributes are written between <metaversepreview and >, separated by spaces or line breaks.
Multiple repeated attributes (recursive image overlays) are written between <metaversepreview ... > and </metaversepreview>. Each recursively overlaid image is drawn on the display image in sequence, with later images overlaying earlier ones specified in previewimg.
Single Basic Attributes:
key | required? | description |
---|---|---|
backgroundcolor | No | Background color, the default is "ffffff" for pure white. |
any other keys you want | No | If you are using your own template script, you can define any keys you need that are referenced in your script. |
Multiple Attributes previewimg :
The image resources used in these examples have not actually been placed on the blockchain, the listed addresses are fictitious. Please manually upload any recursive image resources you need for referencing.
In this template, when there is no 'previewimg' property, the display template will automatically fetch the original image for display based on the metaverse configuration. When 'previewimg' exists, the default image will not be used, and developers need to manually insert the original image into 'previewimg' following the recursive order.
Here, we use other three on-chain resource images as the recursively overlaid images for preview display. They are as follows:
The attributes for recursive images are written between , separated by spaces or line breaks.
key | required? | description |
---|---|---|
src | Yes | The on-chain address of the recursive image |
size | No | The scaling size of the recursive image, default is [1,1] |
position | No | The default position of the recursive image, default is [0.5,0.5] |
rotation | No | The default rotation of the recursive image, value range is 0-360, default is 0 |
isatlas | No | Whether it is an image atlas |
atlasrange | No | This attribute marks a specific area in the image atlas, [x,y,z,w]. x,y: are the pixel coordinates for the beginning of the area being referenced; z,w: are the dimensions of the area. See the atlas attribute key in 2D Res Inscriptions for details |
issheet | No | Whether it is an evenly divided image atlas (sheet) |
sheetlayout | No | The horizontal and vertical tiling divisions of the sheet [x,y], x: number of horizontal divisions, y: number of vertical divisions |
sheetindex | No | The display image index number in the sheet image atlas |
Last updated