import javafx.ext.swing.SwingSlider; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.ext.swing.SwingLabel; import javafx.scene.image.ImageView; import javafx.scene.image.Image; // スライダの値 var sliderValue = 0; Stage { title: "Slide Images" scene: Scene { width: 300 height: 500 content: [ SwingSlider { translateX: 20 translateY: 15 width: 260 minimum: 0 maximum: 100 value: bind sliderValue with inverse vertical: false }, // 2 枚のイメージで透明度を変化させる ImageView { x: 0 y: 50 opacity: bind sliderValue / 100.0 image: Image { url: "{__DIR__}herme.jpg" } }, ImageView { x: 0 y: 50 opacity: bind 1.0 - sliderValue / 100.0 image: Image { url: "{__DIR__}aoki.jpg" } } ] } }