Frodo goes to Mordor (directly)
This commit is contained in:
parent
190877c10e
commit
11b278fc81
@ -3,11 +3,15 @@ import androidx.compose.desktop.ui.tooling.preview.Preview
|
|||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.window.Window
|
import androidx.compose.ui.window.Window
|
||||||
import androidx.compose.ui.window.application
|
import androidx.compose.ui.window.application
|
||||||
import center.sciprog.maps.scheme.*
|
import center.sciprog.maps.scheme.*
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.isActive
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Preview
|
@Preview
|
||||||
@ -20,6 +24,7 @@ fun App() {
|
|||||||
1f
|
1f
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
|
||||||
SchemeView(
|
SchemeView(
|
||||||
@ -36,6 +41,21 @@ fun App() {
|
|||||||
text(410.52737 to 868.7676, "Shire", color = Color.Blue)
|
text(410.52737 to 868.7676, "Shire", color = Color.Blue)
|
||||||
circle(1132.0881 to 394.99127, color = Color.Red)
|
circle(1132.0881 to 394.99127, color = Color.Red)
|
||||||
text(1132.0881 to 394.99127, "Ordruin", color = Color.Red)
|
text(1132.0881 to 394.99127, "Ordruin", color = Color.Red)
|
||||||
|
|
||||||
|
val hobbitId = circle(410.52737 to 868.7676)
|
||||||
|
|
||||||
|
scope.launch {
|
||||||
|
var t = 0.0
|
||||||
|
while (isActive) {
|
||||||
|
val x = 410.52737 + t * (1132.0881 - 410.52737)
|
||||||
|
val y = 868.7676 + t * (394.99127 - 868.7676)
|
||||||
|
circle(x to y, color = Color.Green, id = hobbitId)
|
||||||
|
delay(100)
|
||||||
|
t += 0.005
|
||||||
|
if (t >= 1.0) t = 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user