Forked (http://codepen.io/csswizardry/pen/PjPXrg by Harry Roberts)
import javafx.animation.Animation; import javafx.animation.Interpolator; import javafx.animation.RotateTransition; import javafx.animation.SequentialTransition; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCodeCombination; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.stage.Stage; import javafx.util.Duration; public class Main extends Application { @Override public void start(Stage stage) throws Exception { int radius = 20; Color fill = Color.WHITE; Circle center = new Circle(150, 150, radius, fill); Circle c1 = new Circle(150 - radius*2, 150 - radius*2, radius, fill); Circle c2 = new Circle(150 + radius*2, 150 + radius*2, radius, fill); Circle c3 = new Circle(150 - radius*2, 150 + radius*2, radius, fill); Group root = new Group(center, c1, c2, c3); RotateTransition rt = new RotateTransition(Duration.seconds(1.5), root); rt.setInterpolator(Interpolator.EASE_BOTH); rt.setFromAngle(-360*5); rt.setToAngle(-50); rt.setCycleCount(Animation.INDEFINITE); rt.setAutoReverse(true); rt.play(); stage.setScene(new Scene(root, 300, 300, Color.web("#272727"))); stage.show(); stage.getScene().getAccelerators().put(new KeyCodeCombination(KeyCode.ESCAPE), () -> System.exit(0)); } public static void main(String[] args) { launch(args); } }
styled using hilite.me
No comments:
Post a Comment