Difference between revisions of "Curves.tbl"
(Created page with "{{SCP_table}} {{Tables}} The '''curves.tbl''' allows for defining arbitrary mathematical functions, a mapping from an arbitrary X value to an arbitrary Y value. These can be u...") |
|||
Line 24: | Line 24: | ||
==Interpolation functions== | ==Interpolation functions== | ||
{{Table232| | {{Table232| | ||
− | Interpolation functions define how the curve should change in between keyframes. There are several basic interpolation functions, but note that any previously defined curve can itself be used as an interpolation function. The engine provides quite a few [[non-basic curves]] as well. | + | Interpolation functions define how the curve should change in between keyframes. There are several basic interpolation functions, but note that any previously defined curve can itself be used as an interpolation function. The engine provides quite a few [[Curves.tbl#Built-in Curves|non-basic curves]] as well. |
− | |||
===Constant=== | ===Constant=== | ||
Line 39: | Line 38: | ||
Parameters: | Parameters: | ||
*''Float'', Degree. A degree 2 polynomial is quadratic, degree 3 is cubic, etc. High degree makes the 'gentle' end even gentler and the 'harsh' end even harsher. | *''Float'', Degree. A degree 2 polynomial is quadratic, degree 3 is cubic, etc. High degree makes the 'gentle' end even gentler and the 'harsh' end even harsher. | ||
− | *''Boolean'', "Ease in". Whether to "ease in" or "ease out". Easing in means the slow, gentle end is first and then the function harshly goes to the next Y value. Easing out does the opposite, it harshly goes to the next Y value, and spends most of the time gradually arriving. | + | *''Boolean'', "Ease in". Defaults to true. Whether to "ease in" or "ease out". Easing in means the slow, gentle end is first and then the function harshly goes to the next Y value. Easing out does the opposite, it harshly goes to the next Y value, and spends most of the time gradually arriving. |
===Circular=== | ===Circular=== | ||
− | A smooth interpolation | + | A smooth interpolation function which takes the form of a (possibly stretched) circular segment. |
Parameters: | Parameters: | ||
− | *'' | + | *''Boolean'', "Ease in". Defaults to true. Whether to "ease in" or "ease out". Easing in means the slow, gentle end is first and then the function harshly goes to the next Y value. Easing out does the opposite, it harshly goes to the next Y value, and spends most of the time gradually arriving. |
+ | |||
+ | ===Any other previously defined curve=== | ||
+ | Provided the curve has already been defined, another curve may next into new ones. This keyframe's X and Y values will be used as 0, 0 in the original curve, and the next keyframe's X and Y values will be uesd as 1, 1 in the original curve. | ||
+ | *No parameters. | ||
+ | }} | ||
+ | |||
+ | ==Built-in Curves== | ||
+ | {{Table232| | ||
+ | Many functions from [https://easings.net/ Easing functions] are provided built-in. All of the 'Quad', 'Cubic', 'Quart', 'Quint', 'Circ' curves are avilable under the names used on the website. Additionally, all built-in curves also have 'reversed' versions which decrease from 1 to 0 instead of ascending from 0 to 1, which end in 'Rev' (such as 'easeInOutQuadRev'). | ||
}} | }} | ||
==Sample Entry== | ==Sample Entry== | ||
<pre> | <pre> | ||
− | # | + | #Curves |
− | $ | + | $Name: test1 |
− | $ | + | $KeyFrames: |
+ | (0, 1): Polynomial, 2, true | ||
+ | (1, 0): Constant | ||
− | $ | + | $Name: test2 |
− | + | $KeyFrames: | |
+ | (0, 0): Circular | ||
+ | (0.5, 1): EaseInQuad | ||
+ | (1, 0): Constant | ||
− | + | #End | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | # | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Tables]] | [[Category:Tables]] |
Revision as of 09:12, 28 April 2023
This feature requires FreeSpace Open |
List of Tables and related code files | |
---|---|
* Notes Modular Tables | |
** Notes tables which only use modular tables | |
Ai.tbl* | /ai/aicode.cpp |
Ai_profiles.tbl* | /ai/ai_profiles.cpp |
Animation.tbl** | /model/modelanimation.cpp |
Armor.tbl* | /ship/ship.cpp |
Asteroid.tbl* | /asteroid/asteroid.cpp |
Autopilot.tbl* | /autopilot/autopilot.cpp |
Cheats.tbl* | /cheats_table/cheats_table.cpp |
Colors.tbl* | /globalincs/alphacolors.cpp |
Curves.tbl* | /math/curves.cpp |
Controlconfigdefaults.tbl | /controlconfig/controlsconfigcommon.cpp |
Credits.tbl* | /menuui/credits.cpp |
Cutscenes.tbl* | /cutscene/cutscenes.cpp |
Decals.tbl** | /decals/decals.cpp |
Fireball.tbl* | /fireball/fireballs.cpp |
Fonts.tbl* | /graphics/font.cpp |
Game_settings.tbl* | /mod_table/mod_table.cpp |
Glowpoints.tbl* | /model/modelread.cpp |
Help.tbl* | /gamehelp/contexthelp.cpp |
Hud_gauges.tbl* | /hud/hudparse.cpp |
Icons.tbl* | /mission/missionbriefcommon.cpp |
Iff_defs.tbl* | /iff_defs/iff_defs.cpp |
Keywords.tbl* | Not In Codebase |
Lighting_Profiles.tbl* | /lighting/lighting_profiles.cpp |
Lightning.tbl* | /nebula/neblightning.cpp |
Mainhall.tbl* | /menuui/mainhallmenu.cpp |
Medals.tbl* | /stats/medals.cpp |
Messages.tbl* | /mission/missionmessage.cpp |
Mflash.tbl* | /weapon/muzzleflash.cpp |
Music.tbl* | /gamesnd/eventmusic.cpp |
Nebula.tbl* | /nebula/neb.cpp |
Objecttypes.tbl* | /ship/ship.cpp |
Options.tbl* | Not In Codebase |
Particle effects(-part.tbm)** | /particle/effects... |
Post_processing.tbl | /graphics/gropenglpostprocessing.cpp |
Rank.tbl* | /stats/scoring.cpp |
Scpui.tbl* | Not In Codebase |
Scripting.tbl* | /parse/scripting.cpp |
Ships.tbl* | /ship/ship.cpp |
Sexps.tbl** | /parse/sexp/sexp_lookup.cpp |
Sounds.tbl* | /gamesnd/gamesnd.cpp |
Species_defs.tbl* | /species_defs/species_defs.cpp |
Species.tbl* | /menuui/techmenu.cpp |
Ssm.tbl* | /hud/hudartillery.cpp |
Stars.tbl* | /starfield/starfield.cpp |
Strings.tbl* | /localization/localize.cpp |
Tips.tbl* | /menuui/playermenu.cpp |
Traitor.tbl* | /stats/scoring.cpp |
Tstrings.tbl* | /localization/localize.cpp |
Virtual_pofs.tbl* | /model/modelreplace.cpp |
Weapon_expl.tbl* | /weapon/weapons.cpp |
Weapons.tbl* | /weapon/weapons.cpp |
The curves.tbl allows for defining arbitrary mathematical functions, a mapping from an arbitrary X value to an arbitrary Y value. These can be used in a variety of different ways, and what X and Y are are specific to the particular situation which calls for a curve.
This table is one of the Modular Tables and can be extended with xxx-crv.tbm
Contents
#Curves
This section defines the individual curve functions.
$Name:
The unique name to identify this particular curve.
$Keyframes:
- Required once for a curve, to begin listing its keyframes with the following syntax:
(X, Y): Interpolation function, any paramters...
- Entries like the above can be repeated as many times as necessary
- The X values must come in ascending order
- The last X value must be at least 1
Example:
(0, 1): Polynomial, 2, true
Interpolation functions
Interpolation functions define how the curve should change in between keyframes. There are several basic interpolation functions, but note that any previously defined curve can itself be used as an interpolation function. The engine provides quite a few non-basic curves as well.
Constant
The simplest interpolation, the output Y value is equal to the keyframe's Y value for its entire domain.
- No parameters.
Linear
A slightly less simple interpolation, the output Y value is a straight line between the keyframe's Y value and the next keyframe's Y value.
- No parameters.
Polynomial
A smooth interpolation gentle at one end, harsh on the other. The output Y value is a polynomial curve of the given degree from the keyframe's Y value and the next keyframe's Y value. Parameters:
- Float, Degree. A degree 2 polynomial is quadratic, degree 3 is cubic, etc. High degree makes the 'gentle' end even gentler and the 'harsh' end even harsher.
- Boolean, "Ease in". Defaults to true. Whether to "ease in" or "ease out". Easing in means the slow, gentle end is first and then the function harshly goes to the next Y value. Easing out does the opposite, it harshly goes to the next Y value, and spends most of the time gradually arriving.
Circular
A smooth interpolation function which takes the form of a (possibly stretched) circular segment. Parameters:
- Boolean, "Ease in". Defaults to true. Whether to "ease in" or "ease out". Easing in means the slow, gentle end is first and then the function harshly goes to the next Y value. Easing out does the opposite, it harshly goes to the next Y value, and spends most of the time gradually arriving.
Any other previously defined curve
Provided the curve has already been defined, another curve may next into new ones. This keyframe's X and Y values will be used as 0, 0 in the original curve, and the next keyframe's X and Y values will be uesd as 1, 1 in the original curve.
- No parameters.
Built-in Curves
Many functions from Easing functions are provided built-in. All of the 'Quad', 'Cubic', 'Quart', 'Quint', 'Circ' curves are avilable under the names used on the website. Additionally, all built-in curves also have 'reversed' versions which decrease from 1 to 0 instead of ascending from 0 to 1, which end in 'Rev' (such as 'easeInOutQuadRev').
Sample Entry
#Curves $Name: test1 $KeyFrames: (0, 1): Polynomial, 2, true (1, 0): Constant $Name: test2 $KeyFrames: (0, 0): Circular (0.5, 1): EaseInQuad (1, 0): Constant #End