Hey all. Having a bit of an issue with animating a...
# tornadofx
s
Hey all. Having a bit of an issue with animating after switching a VBox to be a global value. Anyone know why the animation is happening instantly after the inputted time instead of interpolating?
For reference, I basically need to blur the root of the first view in the application from multiple places within the app when an action is called. Not sure if making the pane a global value is the best way to go about it.
h
Are effect animatable? AFAIK they aren't (though I have never tried). Instead could you animate the blur radius or something.
Something like this:
Copy code
fun blur(forwards: Boolean) {
        if (forwards) {
            val blur = GaussianBlur(0.0)
            defaultView.effect = blur
            blur.radiusProperty().animate(60.0, 2.seconds)
        }
...
Regarding the design, I do something similar using an
EventBus
. Anything in the application can post an event to the bus and then when notified interested UI elements can update their apperance.
That way you wouldnt have to make
defaultView
global
s
Animating the blur radius did the trick! I could have sworn I animated the blur property somewhere before... guess I was dreaming 🤯
a
I love reading about these animation tidbits! I feel like I'm learning all the time from this
h
animate
should probably be defined on something more restrictive than
WritableValue<T>
to avoid this kinda thing