Stroke Dash Offset প্রপার্টি
যদি স্ট্রোক একটি ড্যাশিং প্যাটার্ন হয়, তবে strokeDashOffset প্রপার্টি ড্যাশিং প্যাটার্নের অফসেট নির্দিষ্ট করে। অর্থাৎ ড্যাশ ফেজ ড্যাশিং প্যাটার্নের সেই বিন্দু নির্ধারণ করে যা স্ট্রোকের শুরুতে মিলবে।
উদাহরণ
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Line;
import javafx.scene.shape.Polygon;
import javafx.stage.Stage;
public class StrokeDashOffset extends Application {
public void start(Stage stage) {
Line shape1 = new Line(25.0, 50.0, 565.0, 50.0);
shape1.setStroke(Color.BROWN);
shape1.setStrokeWidth(10);
shape1.getStrokeDashArray().addAll(80.0, 70.0, 60.0, 50.0, 40.0);
shape1.setStrokeDashOffset(5);
Polygon shape2 = new Polygon(25.0, 150.0, 565.0, 150.0);
shape2.setStroke(Color.CRIMSON);
shape2.setStrokeWidth(10.0);
shape2.getStrokeDashArray().addAll(80.0, 70.0, 60.0, 50.0, 40.0);
shape2.setStrokeDashOffset(40);
Group root = new Group(shape1, shape2);
Scene scene = new Scene(root, 595, 200);
stage.setTitle("Stroke Dash Offset Example");
stage.setScene(scene);
stage.show();
}
public static void main(String args[]){
launch(args);
}
}
আউটপুট
