旋转风车
实现效果
这样的一个风车不断均匀的顺时针旋转。
实现代码
import javafx.animation.Animation;
import javafx.animation.Interpolator;
import javafx.animation.RotateTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import javafx.util.Duration;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws InterruptedException {
Pane pane = new Pane(); // 创建一个面板
// 画一个圆,并将圆的圆心和半径和面板大小进行绑定,确保圆永远显示在中间,设置边缘为黑色,内部为白色
Circle circle = new Circle();
circle.centerXProperty().bind(pane.widt