-
Notifications
You must be signed in to change notification settings - Fork 3
Text Transitions
Text Transitions are a special type of RichTextEffect that give characters a special animation when they appear. This plugin currently comes with a single transition effect, called "fade" ([t_fade]), which is located in the "transitions" folder of the plugin. It causes the text to fade in gently when it appears.
Before a transition effect is available, you will have to add it to the messagebox you want to use it on, similarly to regular text effects. In this case, you can do that by one of three methods:
- Add them in the inspector, in the "Transitions" array. Any included here will be automatically installed when that MessageBox is created.
- Using
install_transition. This works exactly the same way asinstall_effectdoes with effects. Note that you MUST useinstall_transitionand NOTinstall_effectto install transitions, or they will not be able to run. (install_transitionhas a little bit of setup magic required to make it work.)RichTextEffects can still be added via all of the standard methods and are completely unaffected by the transitions system. - By setting the
transitionsvariable. Setting it to a new array will completely replace all existing transition effects. Mutation functions are not explicitly supported and may or may not work as expected.
Once a transition is made available, it can be used like any other bbcode tag. Only characters within it will be affected by the transition effect, as per usual.
There are two methods available for removing installed transition effects, although both are currently experimental and untested:
- Using
remove_transition. Please note that the transition instance passed to this function must be the same instance already installed on the messagebox. - As mentioned above, setting the
transitionsvariable will completely replace the installed transitions, removing any that are not in the new array. NOTE: Directly erasing a transition fromcustom_effectsis not recommended as it may corrupt the node state and cause unexpected behavior.
For a very simple example, take a look at the included transition script. It is just like an ordinary RichTextEffect, but with a few notable additions:
- The
ownerdeclaration, which should be the same in all transition scripts - A non-null check for
owner(just to be safe) - The use of
owner._get_deltaEssentially,owner._get_deltais used to query the MessageBox the transition is installed on for the transition progress.owner.get_delta(int ind, float time)returns a float between 0 and 1 representing the percentage of completion the character ofindshould display, assuming the animation takestimeseconds to complete. In the example effect, this is passed directly to the alpha tint.