2 Replies Latest reply: Oct 26, 2012 12:21 PM by 893630 RSS

    Swipe Effect through mouse click

    893630
      Hi,
      I am new to animations and trying to add few in my application.

      (1)Whenever I am navigating to different page (by a click or double click of a node ), I want to have an animation -- old page moving towards left and getting removed altogether and new page getting loaded from right hand side.
      Something like a page swipe in ios/android devices . However my application is not for touch enabled devices for now.

      Is this possible though javafx 2.x . If so , could you direct me to appropriate sample/api.

      (2) Can a click of a mouse be mapped to Gesture Events. For example - I click a link/button for navigation and application takes it as a Swipe Event and hence navigates to a different page giving swipe effect ?

      Thanks
        • 1. Re: Swipe Effect through mouse click
          jsmith
          (1) Whenever I am navigating to different page (by a click or double click of a node ), I want to have an animation -- old page moving towards left and getting removed altogether and new page getting loaded from right hand side.
          Yes, see:
          http://docs.oracle.com/javafx/2/animations/basics.htm#CJAJJAGI (Transitions)
          http://docs.oracle.com/javafx/2/api/javafx/animation/package-summary.html (Animation API)
          http://www.e-zest.net/blog/sliding-in-javafx-its-all-about-clipping/ (Sliding in JavaFX)
          http://fxexperience.com/2012/03/canned-animations/ (Animation Lib)
          http://gist.github.com/1437374 (Panel Slide Effect)
          (2) Can a click of a mouse be mapped to Gesture Events
          I don't think this can be done with the public API. One way to do it would be to add a filter on your layout pane which consumes the mouse click event and generates a SwipeEvent, but SwipeEvent has no constructor - so this would not work. There is an existing Jira request to create public constructors for event classes so that this kind of thing could be done. Perhaps you could make use of private impl_ apis or com.sun classes to allow this to be done with JavaFX 2.2, but I wouldn't recommend that approach.

          Also it is probably best to place separate questions in separate posts for ease of searching etc.
          • 2. Re: Swipe Effect through mouse click
            893630
            Thanks for the prompt reply. I will take care about posting different questions in different posts.