q&d hack for ui opacity control using a shader

This commit is contained in:
minjaesong
2020-09-12 11:24:32 +09:00
parent 9b079d0467
commit f9883f2516
6 changed files with 61 additions and 12 deletions

View File

@@ -15,10 +15,10 @@ class UIItemHorizontalFadeSlide(
//transitionLength: Float,
currentPosition: Float,
vararg uis: UICanvas
) : UIItemTransitionContainer(parent, initialX, initialY, width, height, 0.212f, currentPosition, uis) {
) : UIItemTransitionContainer(parent, initialX, initialY, width, height, 0.15f, currentPosition, uis) {
fun getOffX(index: Int) = ((currentPosition - index) * width / 2f).roundToInt()
fun getOpacity(index: Int) = (currentPosition - index).coerceIn(0f, 1f)
fun getOpacity(index: Int) = 1f - (currentPosition - index).coerceIn(0f, 1f) // fixme make it work for both direction
init {
// re-position the uis according to the initial choice of currentPosition