-
Notifications
You must be signed in to change notification settings - Fork 0
2. Backgrounds
This page will go over the different picture modes, how to order layers, and the parallax effect, with the goal of making a simple background.
The first configuration we'll go over is picture modes. Frame has 4 of them and the field to set the picture mode takes a string
The default picture mode, makes sure the entire texture is visible vertically, while cropping out parts horizontally.
myLayer.mode = "fill"Just like the fill mode, but fits the texture horizontally instead of vertically.
myLayer.mode = "fit"This mode stretches the texture corner to corner to fit the screen.
myLayer.mode = "stretch"This mode grids the texture across the screen. This works best with smaller images that already grid like Minecraft's textures. This also works with animated textures, which will be explained in another guide.
myLayer.mode = "grid"Layers can be ordered to allow setting layers on top of other layers, or for having foregrounds which appear in front of the player's avatar preview.
Note
Transparency may not always work. In the examples shown, the transparency wasn't working so layers and the avatar below were culled by the transparency.
The examples show a background and foreground order, with the mode set to stretch for both.
The order can be any number between 0 and 999 including decimals. Increasing the order brings it closer to the foreground and above the avatar preview.
myLayer.order = 0A parallax effect can be applied to any layer, and makes the layer move according to the pointer position. A positive number makes the layer parallax away from the pointer and a negative number brings the layer towards the pointer.
The number you give it is how many pixels off the edge the layer should zoom in to allocate for the parallax effect. If that doesn't make sense, a bigger number means the parallax effect is stronger and the layer is zoomed in more.
The first gif shows a parallax of 20, and the second shows a parallax of 200