忍者ブログ

からすまる日誌

20200109pm03 animationサンプル1-6

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

20200109pm03 animationサンプル1-6

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座標を取得するのがあるらしい
当たり判定をするならそれをつかうだろう 
 
と 
 
PR

コメント

ブログ内検索

カレンダー

04 2025/05 06
S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31