Nick
12/03/2022, 6:05 AMval animate: Animator
val anim = animate(0.0 to 100.0, tweenDouble(easeInOutCubic, 250 * milliseconds)) { value ->
// ...
}
val animations = animate {
anim1 = 0.0 to 100.0 using tweenDouble(easeInOutCubic, 250 * milliseconds).invoke { value ->
// ...
}
anim2 = Red to Blue using tweenColor(easeInOutCubic, 250 * milliseconds).invoke { value ->
// ...
}
// ...
}
class Foo(animate: Animator) {
var color by animate(initialColor, tweenColor(linear, 1 * seconds)) { old, new ->
rerenderNow()
}
}
New FileSelector Control
A new component to trigger file selection. This has also been adapted to 2 form controls: file
and files
to select one or multiple files. It requires the use of the nativeFileSelectorBehavior()
module. It can be customized like TextField
via NativeFileSelectorStyler
, which is available for injection when nativeFileSelectorBehavior()
is installed.
Please play around with the release and provide feedback. I'll be working on bug fixes etc. with the goal of releasing in the next week or so.Nick
12/13/2022, 5:06 AMayodele
12/13/2022, 6:57 PMayodele
12/18/2022, 4:05 PMayodele
12/18/2022, 4:05 PMNick
12/18/2022, 4:19 PMayodele
12/18/2022, 4:56 PMNick
12/18/2022, 5:02 PMayodele
12/18/2022, 5:07 PMayodele
12/18/2022, 5:08 PMfun main() {
application(modules = listOf(PointerModule)) {
MainApp(display = instance(), textMetrics = instance())
}
}
class MainApp(display: Display, textMetrics: TextMetrics): Application{
init {
val view = PushButton("Hi!").apply {
size = Size(150.0, 50.0)
acceptsThemes = false
cursor = Pointer
fired += {
console.log("Fired!")
}
behavior = simpleTextButtonRenderer(textMetrics){ button, canvas ->
val draw = {canvas.rect(bounds.atOrigin, radius = 8.0, fill = Color.Blue.paint)}
canvas.outerShadow { draw() }
canvas.text(button.text, at = textPosition(button, button.text), color = Color.White)
}
}
display += view
}
override fun shutdown() {}
}
Nick
12/18/2022, 5:18 PMayodele
12/18/2022, 5:20 PMayodele
12/18/2022, 5:21 PMconstraint
, no parent.left
or <http://parent.top|parent.top>
Nick
12/18/2022, 5:25 PMleft
and top
to 0 to have the same effect.ayodele
12/18/2022, 5:31 PMayodele
12/18/2022, 5:31 PMNick
12/18/2022, 7:36 PMayodele
12/18/2022, 7:41 PMeq
does. But I'm still trying to grasp lessEq
and greaterEq
. Can you give a brief summary??Nick
12/18/2022, 7:52 PMview.width lessEq 100
(view.width eq parent.width/2) .. Strong
This would allow the view’s width to scale with it’s parent until the parent’s width is greater than 200. Similar for greaterEq
. You can use them to bound a value. A good example is confining a view so it can slide within a min and max location.Nick
12/21/2022, 2:04 AMNick
12/21/2022, 2:11 AMclipCanvasToBounds
. https://github.com/nacular/doodle/blob/a0492b9824a9f458ea0a1138e1ff1c07a3deebc9/Core/src/commonMain/kotlin/io/nacular/doodle/core/View.kt#L221. or the equivalent from a Behavior.Nick
12/22/2022, 4:09 AMNick
12/26/2022, 5:54 PMayodele
12/27/2022, 6:39 PM