有没有办法在javafx中制作图像饱和动画?

例如我有类似的东西

ImageView img = new ImageView();
img.setImage(new Image("someimg.png"));
ColorAdjust ca = new ColorAdjust();
ca.setSaturation(0.5);
img.setEffect(ca)

我希望饱和度随时间平稳增加。有没有办法做到这一点,例如使用时间轴对象?

liqilong2259 回答:有没有办法在javafx中制作图像饱和动画?

我找到了解决方法

    ImageView img = new ImageView();
    img.setImage(new Image("someimg.png"));

    ColorAdjust ca = new ColorAdjust();
    img.setEffect(ca);

    Timeline t = new Timeline(
            new KeyFrame(Duration.ZERO,new KeyValue(ca.saturationProperty(),-1.0)),new KeyFrame(Duration.seconds(5),1.0))
    );

    t.play();
本文链接:https://www.f2er.com/3144772.html

大家都在问