-
Notifications
You must be signed in to change notification settings - Fork 136
/
Modifiers.kt
69 lines (57 loc) · 2.08 KB
/
Modifiers.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package org.hexworks.zircon.api
import org.hexworks.zircon.api.builder.modifier.BorderBuilder
import org.hexworks.zircon.api.modifier.*
import org.hexworks.zircon.api.modifier.SimpleModifiers.*
/**
* This object contains factory methods for the [Modifier]s supported by Zircon.
*/
object Modifiers {
fun underline(): Modifier = Underline
fun blink(): Modifier = Blink
fun crossedOut(): Modifier = CrossedOut
fun hidden(): Modifier = Hidden
/**
* Shorthand for the default border which is:
* - a simple border
* - on all sides (top, right, bottom, left)
* @see BorderBuilder if you want to create custom borders
*/
fun border(): Border = org.hexworks.zircon.api.builder.modifier.border { }
/**
* Provides a fade in effect for the tile that has this modifier.
* The effect will start when the tile is added to a tile grid.
* @param steps the number of frames for the fade effect
* @param timeMs the time (in milliseconds) the effect takes
* when the effect finishes.
*/
fun fadeIn(
steps: Int = 20,
timeMs: Long = 2000,
): Modifier = FadeIn(steps, timeMs)
/**
* Provides a fade out effect for the tile that has this modifier.
* The effect will start when the tile is added to a tile grid.
* @param steps the number of frames for the fade effect
* @param timeMs the time (in milliseconds) the effect takes
*/
fun fadeOut(
steps: Int = 20,
timeMs: Long = 2000
): Modifier = FadeOut(steps, timeMs)
// TODO: move all of this into a builder
fun fadeInOut(
stepsFadeIn: Int = 20,
timeMsFadeIn: Long = 2000,
timeMsBeforeFadingOut: Long = 5000,
stepsFadeOut: Int = 20,
timeMsFadeOut: Long = 2000
): Modifier = FadeInOut(
stepsFadeIn, timeMsFadeIn, timeMsBeforeFadingOut,
stepsFadeOut, timeMsFadeOut
)
/**
* Keeps the tile that has this modifier hidden until [timeMs] milliseconds pass
* after adding the tile to a grid.
*/
fun delay(timeMs: Long): Modifier = Delay(timeMs)
}