저는 몇 가지 JavaFX 자습서를 읽었으며 사용 된 애니메이션 시스템에 대해 몇 가지 질문을했습니다. 내가 이해하지 못했다 무엇JavaFX 애니메이션
Timeline timeline = new Timeline();
Node circle = circles;
timeline.getKeyFrames().addAll(
new KeyFrame(Duration.ZERO, // set start position at 0
new KeyValue(circle.translateXProperty(), random() * 800),
new KeyValue(circle.translateYProperty(), random() * 600)),
new KeyFrame(new Duration(40000), // set end position at 40s
new KeyValue(circle.translateXProperty(), random() * 800),
new KeyValue(circle.translateYProperty(), random() * 600)));
// play 40s of animation
timeline.play();
primaryStage.show();
}
는 translateXProperty() 함수 (및 Y)의 사용뿐만 아니라 키 값 생성자에서 임의의 숫자의 목적이었다. 내가 처리 할 프로세스를 이해하는 방법은 두 개의 프레임 사이에 삽입 된 두 개의 KeyFrames를 만들고 두 번째 KeyValue 객체는 노드의 여러 상태를 간단하게 만들었지 만 그게 맞는지는 잘 모르겠습니다.
내가 찾고 있어요 튜토리얼
은 여기에 있습니다 : http://docs.oracle.com/javafx/2/get_started/animation.htm난 그냥 일을 단순화하기 위해 위의 코드에서 하나의 원을 사용했다.
위의 코드, 특히 무작위 값이 프로그램에서 한 좌표에서 다른 좌표로 40 초 이상 이동한다고 말한 것을 정확하게 이해한다면? 내가 이해하지 못하는 이유는 새 KeyValue (circle.translateYProperty (random() * 600))와 같이 작성되지 않는 이유입니다. 그때? – adc90
'KeyFrame'은 특정 시점을 표시하고,'KeyValue'는 해당 시점에 전용 속성이 가져야하는 값을 표시합니다. 주어진 예제에서 'translateY' 속성은 40 초에'random() * 600' 값을 가져야합니다. –
@ SergeyGrinev 감사합니다. 지금 받으십시오. – adc90