-
Notifications
You must be signed in to change notification settings - Fork 3
/
AnimTest.kt
35 lines (33 loc) · 1.27 KB
/
AnimTest.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
package me.anno.tests.ui
import me.anno.animation.Interpolation
import me.anno.config.DefaultConfig.style
import me.anno.gpu.RenderDoc.disableRenderDoc
import me.anno.engine.EngineBase.Companion.showRedraws
import me.anno.ui.anim.AnimContainer
import me.anno.ui.anim.EventType
import me.anno.ui.anim.MoveAnimation
import me.anno.ui.anim.ScaleAnimation
import me.anno.ui.base.buttons.TextButton
import me.anno.ui.base.components.Padding
import me.anno.ui.base.groups.SizeLimitingContainer
import me.anno.ui.base.groups.PanelListY
import me.anno.ui.base.scrolling.ScrollPanelY
import me.anno.ui.debug.TestEngine.Companion.testUI
/**
* test ui with button that changes size when being hovered
* */
fun main() {
disableRenderDoc()
testUI("AnimTest") {
showRedraws = false
val list = PanelListY(style)
for (i in Interpolation.entries) {
val animContainer = AnimContainer(TextButton(i.nameDesc, false, style), Padding(10, 0), style)
// in the real world better not mix them
animContainer.add(MoveAnimation(EventType.HOVER, i, 0f, 0.5f, 1f, 0.5f))
animContainer.add(ScaleAnimation(EventType.TOUCH, i))
list.add(animContainer)
}
ScrollPanelY(SizeLimitingContainer(list, 250, -1, style), style)
}
}