I tried to understand while reading the articles, it didn’t work out! Please explain in simple terms with an example: there is a StackPane named Mpane you need to increase its size from say 1080 x 720 to 2048 x 1080, help wouldn’t hurt ... thanks in advance!

    1 answer 1

    Node node = mPane; //не пишите имена переменных с заглавной буквы, так не принято //анимация в течении полутора секунд Duration animationDuration = new Duration( 1500 ); Timeline timeline = new TimeLine( //далее перечисляем ключевые точки анимации //порядок не имеет значения //стартовые значения, взаимодействуем с pref параметрами, //т.к. реальные readonly new KeyFrame( Duration.ZERO, new KeyValue( node.prefWidthProperty(), 1080.0 ) ), new KeyFrame( Duration.ZERO, new KeyValue( node.prefHeightProperty(), 720.0 ) ), //конечные значения new KeyFrame( animationDuration, new KeyValue( node.prefWidthProperty(), 2048.0 ) ), new KeyFrame( animationDuration, new KeyValue( node.prefHeightProperty(), 1080.0 ) ) ); timeline.play(); 
    • Thanks for the answer! And you can clarify why I get an error: new KeyFrame (animationDuration, new KeyValue (node.prefHeightProperty (), 1080.0)) symbol: method prefHeightProperty ()
    • @AseTry This comment is hard to judge. I suggest either complement the question with the stackTrace deployed and the code, or (better) ask a new question - Andrey M
    • thanks already figured it out! - AseTry