Java Örnek
Java Örnek
import javafx.animation.FadeTransition;
import javafx.animation.PathTransition;
import javafx.animation.Timeline;
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.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Duration;
/**
*
* @author Burhan
*/
public class JavaApplication4 extends Application {
boolean a;
@Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new Pane();
double width = 600;
double height = 600;
Scene scene = new Scene(pane, width, height);
double radius = Math.min(width, height) * 0.25;
Circle c = new Circle(width / 2, height / 2, radius, Color.TRANSPARENT);
c.setRotate(180);
Text text = new Text("Burhan G�m�soy");
pt.setDuration(Duration.millis(10000));
//The path will be the circle
pt.setPath(c);
//The node will be the text
pt.setNode(text);
pt.setOrientation(
PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
//When the mouse is pressed on the pane the animations will pause
// pane.setOnMousePressed(e->{
// text.setText("sdfsdfsdfs");
// //pt.pause();
// //ft.pause();
// });
//pane.setOnMouseReleased(e -> {
// pt.play();
// ft.play();
// });
pane.setOnMouseClicked(e -> {
a=!a;
if(a){
pt.pause();
ft.pause();
}
else{
pt.play();
ft.play();
}
});
//When the mouse is released from the pane the animations will continue to
play
pane.getChildren().addAll(text);
primaryStage.setScene(scene);
primaryStage.setTitle("WEEK 10");
primaryStage.show();
}