-
Notifications
You must be signed in to change notification settings - Fork 1
Decoration related functions
The functions on this page are available by loading the decoration.lua extension. It is loaded by default.
Returns the decoration at index index
in the form of an object with functions to modify values of it.
Example:
mycooldeco = level:getdecoration(0) -- Get the first decoration in the level.
-- Now you can do stuff with it, such as
mycooldeco:movex(1, 75, 1, 'Linear')
-- to move it.
-- The function used above will be explained later.
Creates a new decoration object with the filename filename
, at depth depth
, on the room roomidx
.
If filename
has an extension (ex. 'box.png'
) it will just use that image. Otherwise, it will use the spritesheet with this name (ex. if filename
is 'letters'
, the decoration will use the json 'letters.json'
and the sheet 'letters.png'
).
The higher depth
is, the farther back it is. You can go into negatives, but you cannot go above the foreground or below the background.
If custonname
is given, that will be the decoration's id. Otherwise, sets its id to deco_[id]
, where [id]
is the index of the decoration.
Example:
mycooldeco = level:newdecoration('circle.png', 10, 0, 'boxDeco')
Sets whether the decoration is visible at the start.
Example:
mycooldeco:setvisibleatstart(true)
Moves the decoration into room room
at beat beat
. Note that room
is 0-indexed.
Example:
mycooldeco:setroom(2, 1)
Moves the decoration to v
% on the x axis at beat beat
with a duration duration
and ease ease
.
v
can be a string surrounded by {}
instead, representing a RDCode formula.room) to 1 (right side of the room).
Example:
mycooldeco:movex(4, 75, 1, 'OutExpo') -- at beat 4, move mycooldeco's x position to 75% with a duration of 1 beat and OutExpo ease
mycoolrow:movex(6, '{f0}', 1, 'Linear') -- and at beat 6, move to f0 over 1 beat, linearly. if f0 is 25, it will go to 25%
Moves the decoration to v
% on the y axis at beat beat
with a duration duration
and ease ease
.
v
can be a string surrounded by {}
instead, representing a RDCode formula.
Example:
mycooldeco:movey(6, 30, 0, 'OutQuad') -- at beat 6, move mycooldeco's y position to 30% with a duration of 0 beats and OutQuad ease
Scales the decoration on the x axis to v
% with a duration duration
and ease ease
.
v
can be a string surrounded by {}
instead, representing a RDCode formula.
Example:
mycooldeco:movesx(8, 2, 1, 'InQuint') -- at beat 8, set mycooldeco's horizontal size to 200% with a duration of 1 beat and InQuint ease.
Scales the decoration on the y axis to v
% with a duration duration
and ease ease
.
v
can be a string surrounded by {}
instead, representing a RDCode formula.
Example:
mycooldeco:movesy(6, 1.5, 1, 'InQuint') -- at beat 6, set mycooldeco's vertical size to 150% with a duration of 1 beat and InQuint ease.
Rotates the decoration to v
degrees with a duration duration
and ease ease
.
v
can be a string surrounded by {}
instead, representing a RDCode formula.
Example:
mycooldeco:rotate(3, 90, 0.5, 'OutSine') -- at beat 3, rotate mycooldeco to 90 degrees with a duration of 0.5 beats and OutSine ease.
Moves the decoration's pivot to x
% on the x axis at beat beat
with a duration duration
and ease ease
.
Example:
mycooldeco:movepx(4, 75, 1, 'OutExpo') -- at beat 4, move mycooldeco's x pivot to 75% with a duration of 1 beat and OutExpo ease
Moves the decoration's pivot to y
% on the y axis at beat beat
with a duration duration
and ease ease
.
Example:
mycooldeco:movepx(4, 75, 1, 'OutExpo') -- at beat 4, move mycooldeco's y pivot to 75% with a duration of 1 beat and OutExpo ease
A helper function to make creating multiple movements at once easier. p
is a key-value table where the key is what function to call and the value is the parameter.
Example:
mycooldeco:move(2, { -- at beat 2,
x = 40, -- move the decoration to 40% on the x axis,
sy = 0.5, -- scale the decoration to half its size on the y axis,
rotate = 90, -- rotate the decoration by 90 degrees, (you can also use rot!)
}, 1, 'Linear') -- with a duration of 1 beat and Linear ease.
Shows the decoration at beat beat
.
Example:
mycooldeco:show(4)
Hides the decoration at beat beat
.
Example:
mycooldeco:hide(4)
Plays the expression expression
at beat beat
.
Example:
mycooldeco:playexpression(2, 'happy') -- play the happy expression at beat 2
Sets the decoration's border to bordertype
, with the color color
, opacity opacity
at beat beat
with a duration duration
and ease ease
.
bordertype
should be None
, Outline
or Glow
.
Example:
mycooldeco:setborder(2, 'Glow', 'FF0000', 100, 1, 'OutExpo') -- at beat 2, sets mycooldeco's border to Glow, with a color of FF0000 (red), opacity of 100 (fully opaque) with a duration of 1 beat and OutExpo ease.
If showtint
is true, sets the decoration's tint to color
with opacity
% opacity, with a duration duration
and ease ease
.
If false, removes the tint from the decoration.
Example:
mycooldeco:settint(4, true, '0000FF', 50, 1, 'OutExpo') -- at beat 4, sets mycooldeco's tint to 0000FF (blue), opacity of 50 with a duration of 1 beat and OutExpo ease.
Sets the decoration's opacity to opacity
at beat beat
with a duration duration
and ease ease
.
Example:
mycooldeco:setopacity(6, 50, 1, 'InQuint') -- at beat 6, set mycooldeco's opacity to 50% with a duration of 1 beat and InQuint ease.