¶
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 = truevar material_input : String = "sprite.image"var HSV : HSV = Objectvar outline : Outline = Objectvar shadow : Shadow = Objectvar dissolve : Dissolve = Objectvar 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 = falsevar flip_y : Bool = falsevar pixelated : Bool = falsevar billboard : SpriteBillboard = SpriteBillboard.nonevar billboard_lock : Float3 = [0, 0, 0]var atlas : Asset = nullvar atlas_image_id : String = nullvar material : Asset = nullvar advanced : Advanced = Object
Dissolve¶
import "luxe: system/sprite.modifier" for Dissolve
no docs found
var enabled : Bool = falsevar image : Asset = nullvar uv : Float4 = [0, 0, 1, 1]var value : Num = 1
HSV¶
import "luxe: system/sprite.modifier" for HSV
no docs found
var enabled : Bool = falsevar hue_change : Num = 0var saturation : Num = 1var value : Num = 1
Outline¶
import "luxe: system/sprite.modifier" for Outline
no docs found
var enabled : Bool = falsevar color : Color = [1, 1, 1, 1]var thickness : Num = 0
Shadow¶
import "luxe: system/sprite.modifier" for Shadow
no docs found
var enabled : Bool = falsevar 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 = falsevar color : Color = [1, 0.92, 0.16, 1]var direction : Float2 = [0, 0]var width : Num = 0var speed : Num = 0var spacing : Num = 0
Sprite¶
import "luxe: system/sprite.modifier" for Sprite
A sprite is an image attached to an entity.
TheSpritemodifier 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
Spritemodifier toentity, drawn usingimage, with a given size ofwidthxheight.var entity = Entity.create(world) var image = Assets.image("luxe: image/logo") Sprite.create(entity, material, 128, 128)
Entity, image: Image)
¶None
Attach a
Spritemodifier 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
Spritemodifier toentity, drawn using a defaultimage. UseSprite.set_imageorSprite.set_materialto change it later.var entity = Entity.create(world) Sprite.create(entity)
Entity, material: Material, width: Num, height: Num)
¶None
Attach a
Spritemodifier toentity, drawn usingmaterial, with a size ofwidthxheight.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
Spritemodifier toentity, drawn usingmaterial. The size of the sprite will be determined by thesprite.imageslot 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
Spritemodifier 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
Spriteattached toentitySprite.destroy(entity)
Entity)
¶Bool
Returns true if
entityhas aSpritemodifier attached.if(Sprite.has(entity)) { Log.print("found sprite") }
Entity, x: Num, y: Num)
¶Bool
Returns true if the
Spriteattached toentitycontains the point atx,y(in world units). Note that the function is based on the spritewidthandheight, 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
Spriteattached toentityis drawn with, so it will draw withmaterialinstead.var material = Assets.material("luxe: material/logo.sprite") Sprite.set_material(entity, material)
Entity)
¶Material
Returns the current material that the
Spriteattached toentityis drawn with.var material = Sprite.get_material(entity)
Entity, image: Image)
¶None
Change the image that the
Spriteattached toentityis drawn with.var image = Assets.image("luxe: image/logo.sprite") Sprite.set_image(entity, image)
Entity)
¶Image
Returns the current image that the
Spriteattached toentityis drawn with.var image = Sprite.get_image(entity)
Entity, x: Num, y: Num)
¶None
Sets the origin of the sprite in relation to the
Transformonentity. Thexandyvalues are0...1range, where0, 0is bottom left, and1, 1is 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
Spriteattached toentityisflippedhorizontally.Sprite.set_flip_h(entity, true)
Entity)
¶Bool
Returns true if the
Spriteattached toentityis flipped horizontally.var flipped = Sprite.get_flip_h(entity)
Entity, flipped: Bool)
¶None
Set whether the
Spriteattached toentityisflippedvertically.Sprite.set_flip_v(entity, true)
Entity)
¶Bool
Returns true if the
Spriteattached toentityis flipped vertically.var flipped = Sprite.get_flip_v(entity)
Entity, kind: SpriteBillboard, lock: Float3)
¶None
Set how the
Spriteattached toentitybehaves as abillboardsprite. 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
Spriteattached toentitybehaves as abillboardsprite.var kind = Sprite.get_billboard(entity) if(kind == SpriteBillboard.fixed_scale) { ... }
Entity, width: Num, height: Num)
¶None
Resize the
Spriteattached toentityto bewidthxheight.Sprite.set_size(entity, 256, 256)
Entity, width: Num)
¶None
Resize the
Spriteattached toentityto have a newwidth.Sprite.set_width(entity, 64)
Entity)
¶Num
Returns the width of the
Spriteattached toentity.var width = Sprite.get_width(entity)
Entity, height: Num)
¶None
Resize the
Spriteattached toentityto have a newheight.Sprite.set_height(entity, 64)
Entity)
¶Num
Returns the height of the
Spriteattached toentity.var height = Sprite.get_height(entity)
Entity, alpha: Num)
¶None
Change the alpha (transparency) of the
Spriteattached toentityto bealpha. Modifies the color.Sprite.set_alpha(entity, 0.5)
Entity)
¶Num
Returns the current alpha of the
Spriteattached toentity.var a = Sprite.get_alpha(entity)
Entity, color: Color)
¶None
Set the color of the
Spriteattached toentityto 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
Spriteattached toentityto 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
Spriteattached toentity.var color = Sprite.get_color(entity)
Entity, x0: Num, y0: Num, x1: Num, y1: Num)
¶None
Set the UV coordinates for the
Spriteattached toentitywith top left atx0,y0and 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
Spriteattached toentity.var uv = Sprite.get_uv(entity)
Entity, x: Num, y: Num)
¶None
Set the skew amounts for the
Spriteattached toentity. The values ofxandyare 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
Spriteattached toentity.var skew = Sprite.get_skew(entity)
Entity)
¶Geometry
Returns the render Geometry for the
Spriteattached 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
Spriteattached 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