1/23 イベント課題提出
つづき
animationサンプル4
https://docs.oracle.com/javase/jp/8/javafx/api/javafx/scene/shape/Circle.html
サークルというオブジェクトを動かしている
1.円をつくる
2.円をgroupにadd
3.タイムライン
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.ZERO, new KeyValue(circle.radiusProperty(), 15)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(1000), new KeyValue(circle.radiusProperty(), 100)));
↑radiusProperty(), 15から
radiusProperty(), 100に大きくなる動き
timeline.getKeyFrames().add(new KeyFrame(Duration.ZERO, new KeyValue(circle.centerXProperty(), 0)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(1000), new KeyValue(circle.centerXProperty(), 300)));
↑circle.centerXProperty(), 0から
circle.centerXProperty(), 300へ動く動き
シリンダーという図形もある
https://docs.oracle.com/javase/jp/8/javafx/api/javafx/scene/shape/Cylinder.html
5
セットイメージに小人の画像を載せる
timeline.setAutoReverse(true);
行ったり来たりする
imgView.setOnMouseClicked(e -> {
imgView.setImage(new Image("kobito2.gif"));
});
クリックしたら画像を切り替える
小人が赤くなるよ
6
オラクル社のサンプル
ここにたくさんあるらしい
rectParallel.setArcHeight(15);
rectParallel.setArcWidth(15);
たぶんここで角丸?
//パス遷移
Path path = new Path();
path.getElements().add(new MoveTo(20,20));
path.getElements().add(new CubicCurveTo(380, 0, 380, 120, 200, 120));
path.getElements().add(new CubicCurveTo(0, 120, 0, 240, 380, 240));
このへんは軌道らしい
自分のいるX座標を取得するのがあるらしい
当たり判定をするならそれをつかうだろう
と