Repository navigation
SliderTimeMode
Up | Previous | Next | Русский
Below is the full source of the class in documentation form. The comments inside the block explain the purpose of the parts of the class, but they are not stored in the working file SliderTimeMode.java: the production code stays clean, and the explanations live in the wiki.
package com.velitask.plugin.official;
/* Time mode of a slide: how the time of nested indicators is related to the track time. */
/* The order of constants matters: the ordinal is saved to the file, the first constant is the default value. */
public enum SliderTimeMode {
/* The source runs at the pace of the track (time multiplier 1). The default value. */
PARENT,
/* Freeze frame: the first frame of the source is shown (multiplier 0). */
FROZEN,
/* The source runs at normal 1x pace from its own start (multiplier 1/player speed). */
REAL
}SliderTimeMode defines how the slider converts the track time into the time that nested indicators (Video, Image) receive. It is the only public helper type of the slider: it is used as the type EnumArrayProperty<SliderTimeMode> in the timeMode property of the SliderIndicator indicator.
Data. The value is stored as the ordinal of the constant: PARENT = 0, FROZEN = 1, REAL = 2. The same number goes into the JSON of the timeMode property (see SliderIndicator JSON).
Settings. In the interface the constants are called "Parent speed" (PARENT), "Freeze frame" (FROZEN) and "Real speed" (REAL).
Drawing. The enum itself draws nothing. Based on it, SliderIndicator calculates:
| Mode | Time multiplier (coef) in SliderTimelineMap
|
Speed that nested indicators receive |
|---|---|---|
PARENT |
1.0 |
player speed |
FROZEN |
0.0 |
0.0 |
REAL |
1.0 / player speed |
1.0 |
The time of a nested indicator inside a slide is contentBase + coef * (t - anchor) (the source bounds are taken into account, see SliderSegment). In FROZEN mode the sound of nested indicators is turned off.
- The order of the constants must not be changed: saved projects store the ordinal, not the name.
- The class is declared
public, unlike the other helper types of the slider (they are package-private), because it is used in the signature of a public property field.