Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:53:15+00:00 2026-06-17T08:53:15+00:00

sample code //node Rectangle rect = new Rectangle (0, 0, 20, 20); //path Text

  • 0

sample code

//node 
Rectangle rect = new Rectangle (0, 0, 20, 20);

//path
Text text = TextBuilder.create()
                       .text("J a v a F X   R o c k s")
                        .font(new Font(50))
                        .x(65)
                        .y(100)
                        .build();
// path transition
 pathTransition = PathTransitionBuilder.create()
                .duration(Duration.seconds(15))
                .path(text)
                .node(rect)
                .orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
                .cycleCount(Timeline.INDEFINITE)
                .autoReverse(true)
                .build();

enter image description here

I want to display part of the the text(path) that traveled by rect node. Meaning in the above figure as rect node traveled until java, i want to be display that part only at that point of time ..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:53:15+00:00Added an answer on June 17, 2026 at 8:53 am

    You can try to assign a clipping area to the Text and update it during animation:

    public void start(Stage primaryStage) {
        final Rectangle pen = new Rectangle(0, 0, 20, 20);
    
        // this pane this contain clipping
        final Pane clip = new Pane();
    
        // listener to update clipping area
        ChangeListener changeListener = new ChangeListener() {
            @Override
            public void changed(ObservableValue ov, Object t, Object t1) {
                Rectangle newrect = new Rectangle(pen.getTranslateX(), pen.getTranslateY(), pen.getWidth(), pen.getHeight());
                newrect.setRotate(pen.getRotate());
                clip.getChildren().add(newrect);
            }
        };
    
        // rect coordinates will be changed during animation, so we will listen to them
        pen.translateXProperty().addListener(changeListener);
        pen.translateYProperty().addListener(changeListener);
        pen.rotateProperty().addListener(changeListener);
    
        final Text text = TextBuilder.create()
                .text("J a v a F X   R o c k s")
                .font(new Font(50))
                .clip(clip)
                .x(65)
                .y(100)
                .build();
    
        PathTransition pathTransition = PathTransitionBuilder.create()
                .duration(Duration.seconds(15))
                .path(text)
                .node(pen)
                .orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
                .build();
    
        // once we done we don't want to store thousands of rectangles used to clip
        pathTransition.setOnFinished(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {
                text.setClip(null);
                clip.getChildren().clear();
            }
        });
    
        Pane root = new Pane();
        root.getChildren().addAll(text, pen);
    
        primaryStage.setScene(new Scene(root, 600, 200));
        primaryStage.show();
        pathTransition.play();
    }
    

    A bit more efficient way to store clipping area can be Canvas object, but it will require a bit of math to draw rectangles with rotation on canvas, so it’s your call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sample code: <!DOCTYPE html> <html> <head> <title>test</title> <script language=javascript type=text/javascript> function init() { var
Our Sample Code EditText txtData = (EditText) findViewById(R.id.txtData); Button btnReadSDFile = (Button) findViewById(R.id.btnReadSDFile); btnReadSDFile.setOnClickListener(new
my sample code is here include 'simple_html_dom.php'; function get_all_links($url){ global $host; $html = new
ideone Sample Code: <?php $a = new ArrayObject(); $a['b'] = array('c'=>array('d')); print_r($a); unset($a['b']['c']); print_r($a);
How to connect to LDAP using node js? Kindly help with sample code. I
Being new to programming I read a lot of sample code and try to
When implementing HTTP services in node.js, there is a lot of sample code like
I'm new to node.js and socket.io. I've got a test server with the sample
I'm using this simple node.js code example but I don't understand why FireBug doesn't
Sample Code: var Day = Ember.Object.extend({ date:null, activities:null, // is set to an Em.ArrayProxy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.