¶
luxe
API (2025.1.2
)¶
luxe: system/sprite.modifier
module¶
Advanced¶
import "luxe: system/sprite.modifier" for Advanced
no docs found
var auto_size : Bool = true
var material_input : String = "sprite.image"
var HSV : HSV = Object
var outline : Outline = Object
var shadow : Shadow = Object
var dissolve : Dissolve = Object
var shine : Shine = Object
Data¶
import "luxe: system/sprite.modifier" for Data
no docs found
var image : Asset = "luxe: image/logo"
var size : Float2 = [64, 64]
var origin : Float2 = [0.5, 0.5]
var skew : Float2 = [0, 0]
var color : Color = [1, 1, 1, 1]
var uv : Float4 = [0, 0, 1, 1]
var flip_x : Bool = false
var flip_y : Bool = false
var pixelated : Bool = false
var billboard : SpriteBillboard = SpriteBillboard.none
var billboard_lock : Float3 = [0, 0, 0]
var atlas : Asset = null
var atlas_image_id : String = null
var material : Asset = null
var advanced : Advanced = Object
Dissolve¶
import "luxe: system/sprite.modifier" for Dissolve
no docs found
var enabled : Bool = false
var image : Asset = null
var uv : Float4 = [0, 0, 1, 1]
var value : Num = 1
HSV¶
import "luxe: system/sprite.modifier" for HSV
no docs found
var enabled : Bool = false
var hue_change : Num = 0
var saturation : Num = 1
var value : Num = 1
Outline¶
import "luxe: system/sprite.modifier" for Outline
no docs found
var enabled : Bool = false
var color : Color = [1, 1, 1, 1]
var thickness : Num = 0
Shadow¶
import "luxe: system/sprite.modifier" for Shadow
no docs found
var enabled : Bool = false
var offset : Float2 = [0, 0]
var color : Color = [0, 0, 0, 1]
var softness : Num = 0
Shine¶
import "luxe: system/sprite.modifier" for Shine
no docs found
var enabled : Bool = false
var color : Color = [1, 0.92, 0.16, 1]
var direction : Float2 = [0, 0]
var width : Num = 0
var speed : Num = 0
var spacing : Num = 0
Sprite¶
import "luxe: system/sprite.modifier" for Sprite
A sprite is an image attached to an entity.
TheSprite
modifier provides flipping, sizing, sub images and more. To attach a sprite to an entity, callSprite.create
:var entity = Entity.create(world) var material = Assets.material("luxe: material/logo") Sprite.create(entity, material, 128, 128)
- create(entity:
Entity
, image:Image
, width:Num
, height:Num
) - create(entity:
Entity
, image:Image
) - create(entity:
Entity
) - create_with(entity:
Entity
, material:Material
, width:Num
, height:Num
) - create_with(entity:
Entity
, material:Material
) - create(entity:
Entity
, atlas:Atlas
, atlas_image:String
) - destroy(entity:
Entity
) - has(entity:
Entity
) - contains(entity:
Entity
, x:Num
, y:Num
) - set_material(entity:
Entity
, material:Material
) - get_material(entity:
Entity
) - set_image(entity:
Entity
, image:Image
) - get_image(entity:
Entity
) - set_origin(entity:
Entity
, x:Num
, y:Num
) - get_origin(entity:
Entity
) - set_flip_h(entity:
Entity
, flipped:Bool
) - get_flip_h(entity:
Entity
) - set_flip_v(entity:
Entity
, flipped:Bool
) - get_flip_v(entity:
Entity
) - set_billboard(entity:
Entity
, kind:SpriteBillboard
, lock:Float3
) - get_billboard(entity:
Entity
) - set_size(entity:
Entity
, width:Num
, height:Num
) - set_width(entity:
Entity
, width:Num
) - get_width(entity:
Entity
) - set_height(entity:
Entity
, height:Num
) - get_height(entity:
Entity
) - set_alpha(entity:
Entity
, alpha:Num
) - get_alpha(entity:
Entity
) - set_color(entity:
Entity
, color:Color
) - set_color(entity:
Entity
, r:Num
, g:Num
, b:Num
, a:Num
) - get_color(entity:
Entity
) - set_uv(entity:
Entity
, x0:Num
, y0:Num
, x1:Num
, y1:Num
) - get_uv(entity:
Entity
) - set_skew(entity:
Entity
, x:Num
, y:Num
) - get_skew(entity:
Entity
) - get_geometry(entity:
Entity
) - set_geometry(entity:
Entity
, geo:Geometry
) - get_auto_size(entity:
Entity
) - set_auto_size(entity:
Entity
, value:Bool
) - get_material_input(entity:
Entity
) - set_material_input(entity:
Entity
, value:Bool
) - get_hsv_adjust(entity:
Entity
) - set_hsv_adjust(entity:
Entity
, enabled:Bool
, hue_change:Num
, saturation:Num
, value:Num
) - set_effect_HSV_enabled(entity:
Entity
, enabled:Bool
) - get_effect_HSV_enabled(entity:
Entity
, enabled:Bool
) - set_effect_HSV_hue_change(entity:
Entity
, hue_change:Num
) - get_effect_HSV_hue_change(entity:
Entity
, hue_change:Num
) - set_effect_HSV_saturation(entity:
Entity
, saturation:Num
) - get_effect_HSV_saturation(entity:
Entity
, saturation:Num
) - set_effect_HSV_value(entity:
Entity
, value:Num
) - get_effect_HSV_value(entity:
Entity
, value:Num
) - get_outline(entity:
Entity
) - set_outline(entity:
Entity
, enabled:Bool
, color:Color
, thickness:Num
) - set_effect_outline_enabled(entity:
Entity
, enabled:Bool
) - get_effect_outline_enabled(entity:
Entity
, enabled:Bool
) - set_effect_outline_color(entity:
Entity
, color:Color
) - get_effect_outline_color(entity:
Entity
, color:Color
) - set_effect_outline_thickness(entity:
Entity
, thickness:Num
) - get_effect_outline_thickness(entity:
Entity
, thickness:Num
) - get_shadow(entity:
Entity
) - set_shadow(entity:
Entity
, enabled:Bool
, offset:Num
, color:Color
, softness:Num
) - set_effect_shadow_enabled(entity:
Entity
, enabled:Bool
) - get_effect_shadow_enabled(entity:
Entity
, enabled:Bool
) - set_effect_shadow_offset(entity:
Entity
, offset:Vector2
) - get_effect_shadow_offset(entity:
Entity
, offset:Vector2
) - set_effect_shadow_color(entity:
Entity
, color:Color
) - get_effect_shadow_color(entity:
Entity
, color:Color
) - get_dissolve(entity:
Entity
) - set_dissolve(entity:
Entity
, enabled:Bool
, image:Image
, uv:List
, value:Num
) - set_effect_dissolve_enabled(entity:
Entity
, enabled:Bool
) - get_effect_dissolve_enabled(entity:
Entity
, enabled:Bool
) - set_effect_dissolve_image(entity:
Entity
, image:Image
) - get_effect_dissolve_image(entity:
Entity
, image:Image
) - set_effect_dissolve_uv(entity:
Entity
, uv:Vector4
) - get_effect_dissolve_uv(entity:
Entity
, uv:Vector4
) - set_effect_dissolve_value(entity:
Entity
, value:Num
) - get_effect_dissolve_value(entity:
Entity
, value:Num
) - get_shine(entity:
Entity
) - set_shine(entity:
Entity
, enabled:Bool
, color:Num
, direction:Vector2
, width:Num
, speed:Num
, spacing:Num
) - set_effect_shine_enabled(entity:
Entity
, enabled:Bool
) - get_effect_shine_enabled(entity:
Entity
, enabled:Bool
) - set_effect_shine_color(entity:
Entity
, color:Color
) - get_effect_shine_color(entity:
Entity
, color:Color
) - set_effect_shine_direction(entity:
Entity
, direction:Vector2
) - get_effect_shine_direction(entity:
Entity
, direction:Vector2
) - set_effect_shine_width(entity:
Entity
, width:Num
) - get_effect_shine_width(entity:
Entity
, width:Num
) - set_effect_shine_speed(entity:
Entity
, speed:Num
) - get_effect_shine_speed(entity:
Entity
, speed:Num
) - set_effect_shine_spacing(entity:
Entity
, spacing:Num
) - get_effect_shine_spacing(entity:
Entity
, spacing:Num
)
Entity
, image: Image
, width: Num
, height: Num
)
¶None
Attach a
Sprite
modifier toentity
, drawn usingimage
, with a given size ofwidth
xheight
.var entity = Entity.create(world) var image = Assets.image("luxe: image/logo") Sprite.create(entity, material, 128, 128)
Entity
, image: Image
)
¶None
Attach a
Sprite
modifier toentity
, drawn usingimage
. The size of the sprite will be determined by the size of the image.var entity = Entity.create(world) var image = Assets.image("luxe: image/logo") Sprite.create(entity, image)
Entity
)
¶None
Attach a
Sprite
modifier toentity
, drawn using a defaultimage
. UseSprite.set_image
orSprite.set_material
to change it later.var entity = Entity.create(world) Sprite.create(entity)
Entity
, material: Material
, width: Num
, height: Num
)
¶None
Attach a
Sprite
modifier toentity
, drawn usingmaterial
, with a size ofwidth
xheight
.var entity = Entity.create(world) var material = Assets.material("luxe: material/logo") Sprite.create_with(entity, material, 128, 128)
Entity
, material: Material
)
¶None
Attach a
Sprite
modifier toentity
, drawn usingmaterial
. The size of the sprite will be determined by thesprite.image
slot in the material.var entity = Entity.create(world) var material = Assets.material("luxe: material/logo") Sprite.create(entity, material)
Entity
, atlas: Atlas
, atlas_image: String
)
¶None
Attach a
Sprite
modifier toentity
, drawn using theatlas
, using the image name in the atlas asatlas_image
, with a size defined by the image in the atlas.var entity = Entity.create(world) var atlas = Assets.atlas("atlas/example") var image_name = "images/atlas/example/tree" Sprite.create(entity, atlas, image_name)
Entity
)
¶None
Detach and destroy the
Sprite
attached toentity
Sprite.destroy(entity)
Entity
)
¶Bool
Returns true if
entity
has aSprite
modifier attached.if(Sprite.has(entity)) { Log.print("found sprite") }
Entity
, x: Num
, y: Num
)
¶Bool
Returns true if the
Sprite
attached toentity
contains the point atx
,y
(in world units). Note that the function is based on the spritewidth
andheight
, it is not pixel perfect.//Convert mouse coords to world units var pos = Camera.screen_point_to_world( app.camera, Input.mouse_x(), Input.mouse_y()) //Check if point is inside the sprite if(Sprite.contains(entity, pos.x, pos.y)) { Log.print("mouse inside sprite!") }
Entity
, material: Material
)
¶None
Change the material that the
Sprite
attached toentity
is drawn with, so it will draw withmaterial
instead.var material = Assets.material("luxe: material/logo.sprite") Sprite.set_material(entity, material)
Entity
)
¶Material
Returns the current material that the
Sprite
attached toentity
is drawn with.var material = Sprite.get_material(entity)
Entity
, image: Image
)
¶None
Change the image that the
Sprite
attached toentity
is drawn with.var image = Assets.image("luxe: image/logo.sprite") Sprite.set_image(entity, image)
Entity
)
¶Image
Returns the current image that the
Sprite
attached toentity
is drawn with.var image = Sprite.get_image(entity)
Entity
, x: Num
, y: Num
)
¶None
Sets the origin of the sprite in relation to the
Transform
onentity
. Thex
andy
values are0...1
range, where0, 0
is bottom left, and1, 1
is top right. A centered sprite is0.5, 0.5
. To set the origin to the center, bottom you'd use0.5, 0
.//centered Sprite.set_origin(entity, 0.5, 0.5) //bottom left Sprite.set_origin(entity, 0, 0) //bottom center Sprite.set_origin(entity, 0.5, 0)
Entity
)
¶Float2
Returns the current origin for the Sprite attached to
entity
.var origin = Sprite.get_origin(entity) Log.print(origin) //[0.5, 0.5]
Entity
, flipped: Bool
)
¶None
Set whether the
Sprite
attached toentity
isflipped
horizontally.Sprite.set_flip_h(entity, true)
Entity
)
¶Bool
Returns true if the
Sprite
attached toentity
is flipped horizontally.var flipped = Sprite.get_flip_h(entity)
Entity
, flipped: Bool
)
¶None
Set whether the
Sprite
attached toentity
isflipped
vertically.Sprite.set_flip_v(entity, true)
Entity
)
¶Bool
Returns true if the
Sprite
attached toentity
is flipped vertically.var flipped = Sprite.get_flip_v(entity)
Entity
, kind: SpriteBillboard
, lock: Float3
)
¶None
Set how the
Sprite
attached toentity
behaves as abillboard
sprite. The lock field is 0 for unlocked rotation, 1 for locked rotation on that axis.Sprite.set_billboard(entity, SpriteBillboard.fixed_scale, [0,1,0])
Entity
)
¶SpriteBillboard
Get how the
Sprite
attached toentity
behaves as abillboard
sprite.var kind = Sprite.get_billboard(entity) if(kind == SpriteBillboard.fixed_scale) { ... }
Entity
, width: Num
, height: Num
)
¶None
Resize the
Sprite
attached toentity
to bewidth
xheight
.Sprite.set_size(entity, 256, 256)
Entity
, width: Num
)
¶None
Resize the
Sprite
attached toentity
to have a newwidth
.Sprite.set_width(entity, 64)
Entity
)
¶Num
Returns the width of the
Sprite
attached toentity
.var width = Sprite.get_width(entity)
Entity
, height: Num
)
¶None
Resize the
Sprite
attached toentity
to have a newheight
.Sprite.set_height(entity, 64)
Entity
)
¶Num
Returns the height of the
Sprite
attached toentity
.var height = Sprite.get_height(entity)
Entity
, alpha: Num
)
¶None
Change the alpha (transparency) of the
Sprite
attached toentity
to bealpha
. Modifies the color.Sprite.set_alpha(entity, 0.5)
Entity
)
¶Num
Returns the current alpha of the
Sprite
attached toentity
.var a = Sprite.get_alpha(entity)
Entity
, color: Color
)
¶None
Set the color of the
Sprite
attached toentity
to be a color. The default color is white,[1, 1, 1, 1]
, so to undo a color change, set it to that.var color = Color.hex(0xf6007c) Sprite.set_color(entity, color)
Entity
, r: Num
, g: Num
, b: Num
, a: Num
)
¶None
Set the color of the
Sprite
attached toentity
to be a color ofr
,g
,b
,a
. The default color is white,[1, 1, 1, 1]
, so to undo a color change, set it to that.Sprite.set_color(entity, r, g, b, a)
Entity
)
¶Color
Returns the current color of the
Sprite
attached toentity
.var color = Sprite.get_color(entity)
Entity
, x0: Num
, y0: Num
, x1: Num
, y1: Num
)
¶None
Set the UV coordinates for the
Sprite
attached toentity
with top left atx0
,y0
and bottom rightx1
,y1
. The default is0, 0, 1, 1
, a full rectangle in UV coordinate space. If you want to tile the image on a sprite, set it to values > 1.//tile 4 times on both x and y Sprite.set_uv(entity, 0, 0, 4, 4)
Entity
)
¶Float4
Returns the current uv of the
Sprite
attached toentity
.var uv = Sprite.get_uv(entity)
Entity
, x: Num
, y: Num
)
¶None
Set the skew amounts for the
Sprite
attached toentity
. The values ofx
andy
are between0 ... 1
, where 1 is the most skew and 0 is none.Sprite.set_skew(entity, 0, 0.25)
Entity
)
¶Float2
Return the skew for the
Sprite
attached toentity
.var skew = Sprite.get_skew(entity)
Entity
)
¶Geometry
Returns the render Geometry for the
Sprite
attached toentity
. The geometry is owned by the sprite, so be aware when modifying it.var geometry = Sprite.get_geometry(entity)
Entity
, geo: Geometry
)
¶unknown
Sets the render Geometry for the
Sprite
attached toentity
.Sprite.set_geometry(entity, geo)
Entity
)
¶Bool
no docs found
Entity
, value: Bool
)
¶None
When setting an image or material, resize the sprite to the image size
Entity
)
¶Bool
no docs found
Entity
, value: Bool
)
¶None
For custom materials, the material input ID for the image.
Entity
)
¶HSV
no docs found
Entity
, enabled: Bool
, hue_change: Num
, saturation: Num
, value: Num
)
¶None
Set the values for the hsv adjustment effect. The effect applies several operations on the colors of the sprite in sRGB HSV space. Saturation and Value changes are applied with exponents as
value ^ adjustment
.
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, hue_change: Num
)
¶None
no docs found
Entity
, hue_change: Num
)
¶None
no docs found
Entity
, saturation: Num
)
¶None
no docs found
Entity
, saturation: Num
)
¶None
no docs found
Entity
, value: Num
)
¶None
no docs found
Entity
, value: Num
)
¶None
no docs found
Entity
)
¶Outline
no docs found
Entity
, enabled: Bool
, color: Color
, thickness: Num
)
¶None
Set the values of the outline effect.
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, color: Color
)
¶None
no docs found
Entity
, color: Color
)
¶None
no docs found
Entity
, thickness: Num
)
¶None
no docs found
Entity
, thickness: Num
)
¶None
no docs found
Entity
)
¶Shadow
no docs found
Entity
, enabled: Bool
, offset: Num
, color: Color
, softness: Num
)
¶None
Set the values for the shadow effect. Shadows are the same color as the base sprite image, but only have a single color.
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, offset: Vector2
)
¶None
no docs found
Entity
, offset: Vector2
)
¶None
no docs found
Entity
, color: Color
)
¶None
no docs found
Entity
, color: Color
)
¶None
no docs found
Entity
)
¶Dissolve
no docs found
Entity
, enabled: Bool
, image: Image
, uv: List
, value: Num
)
¶None
Set the values for the hsv adjustment effect. The effect applies several operations on the colors of the sprite in sRGB HSV space. Saturation and Value changes are applied with exponents as
value ^ adjustment
.
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, image: Image
)
¶None
no docs found
Entity
, image: Image
)
¶None
no docs found
Entity
, uv: Vector4
)
¶None
no docs found
Entity
, uv: Vector4
)
¶None
no docs found
Entity
, value: Num
)
¶None
no docs found
Entity
, value: Num
)
¶None
no docs found
Entity
)
¶Shine
no docs found
Entity
, enabled: Bool
, color: Num
, direction: Vector2
, width: Num
, speed: Num
, spacing: Num
)
¶None
Set the values for the hsv adjustment effect. The effect applies several operations on the colors of the sprite in sRGB HSV space. Saturation and Value changes are applied with exponents as
value ^ adjustment
.
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, enabled: Bool
)
¶None
no docs found
Entity
, color: Color
)
¶None
no docs found
Entity
, color: Color
)
¶None
no docs found
Entity
, direction: Vector2
)
¶None
no docs found
Entity
, direction: Vector2
)
¶None
no docs found
Entity
, width: Num
)
¶None
no docs found
Entity
, width: Num
)
¶None
no docs found
Entity
, speed: Num
)
¶None
no docs found
Entity
, speed: Num
)
¶None
no docs found
Entity
, spacing: Num
)
¶None
no docs found
Entity
, spacing: Num
)
¶None
no docs found
SpriteBillboard¶
import "luxe: system/sprite.modifier" for SpriteBillboard
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
unknown
no docs found
System¶
import "luxe: system/sprite.modifier" for System
no docs found
- new(world:
World
)
World
)
¶System
no docs found