ふんわり表示するプログラムをJavaFXで何となく書いてみた。特に意味なし。
main.fx
package studyfx;
import javafx.animation.Interpolator;
import javafx.animation.Timeline;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
var opacity = 0.0;
def image = Image {
url: "{__DIR__}images/3415358870_1cc377423d_m.jpg"
}
var stage:Stage = Stage {
title: "Application title"
style: StageStyle.TRANSPARENT
width: image.width
height: image.height
scene: Scene {
fill: Color.TRANSPARENT
content: ImageView {
opacity: bind opacity
preserveRatio: true
image: image
onMouseDragged: function(event:MouseEvent):Void {
stage.x += event.dragX;
stage.y += event.dragY;
}
}
}
}
Timeline {
keyFrames: [
at (0s) { opacity => 0.0 },
at (0.5s) { opacity => 1.0 tween Interpolator.EASEBOTH }
]
}.play();
0 件のコメント:
コメントを投稿