<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.twig.es/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.twig.es/index.php?action=history&amp;feed=atom&amp;title=Timeline_Events</id>
		<title>Timeline Events - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.twig.es/index.php?action=history&amp;feed=atom&amp;title=Timeline_Events"/>
		<link rel="alternate" type="text/html" href="https://wiki.twig.es/index.php?title=Timeline_Events&amp;action=history"/>
		<updated>2026-05-06T14:02:51Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.0</generator>

	<entry>
		<id>https://wiki.twig.es/index.php?title=Timeline_Events&amp;diff=1430&amp;oldid=prev</id>
		<title>George2: Created page with &quot;&lt;source lang=&quot;java&quot;&gt; import javafx.application.Application; import javafx.stage.Stage; import javafx.animation.AnimationTimer; import javafx.animation.KeyFrame; import javafx....&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.twig.es/index.php?title=Timeline_Events&amp;diff=1430&amp;oldid=prev"/>
				<updated>2014-11-15T22:38:19Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt; import javafx.application.Application; import javafx.stage.Stage; import javafx.animation.AnimationTimer; import javafx.animation.KeyFrame; import javafx....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import javafx.application.Application;&lt;br /&gt;
import javafx.stage.Stage;&lt;br /&gt;
import javafx.animation.AnimationTimer;&lt;br /&gt;
import javafx.animation.KeyFrame;&lt;br /&gt;
import javafx.animation.KeyValue;&lt;br /&gt;
import javafx.animation.Timeline;&lt;br /&gt;
import javafx.event.ActionEvent;&lt;br /&gt;
import javafx.event.EventHandler;&lt;br /&gt;
import javafx.scene.Group;&lt;br /&gt;
import javafx.scene.Scene;&lt;br /&gt;
import javafx.scene.effect.Lighting;&lt;br /&gt;
import javafx.scene.layout.StackPane;&lt;br /&gt;
import javafx.scene.paint.Color;&lt;br /&gt;
import javafx.scene.shape.Circle;&lt;br /&gt;
import javafx.scene.text.Text;&lt;br /&gt;
import javafx.util.Duration;&lt;br /&gt;
 &lt;br /&gt;
public class TimelineEvents extends Application {&lt;br /&gt;
    &lt;br /&gt;
    //main timeline&lt;br /&gt;
    private Timeline timeline;&lt;br /&gt;
    private AnimationTimer timer;&lt;br /&gt;
 &lt;br /&gt;
    //variable for storing actual frame&lt;br /&gt;
    private Integer i=0;&lt;br /&gt;
 &lt;br /&gt;
    @Override public void start(Stage stage) {&lt;br /&gt;
        Group p = new Group();&lt;br /&gt;
        Scene scene = new Scene(p);&lt;br /&gt;
        stage.setScene(scene);&lt;br /&gt;
        stage.setWidth(500);&lt;br /&gt;
        stage.setHeight(500);&lt;br /&gt;
        p.setTranslateX(80);&lt;br /&gt;
        p.setTranslateY(80);&lt;br /&gt;
 &lt;br /&gt;
        //create a circle with effect&lt;br /&gt;
        final Circle circle = new Circle(20,  Color.rgb(156,216,255));&lt;br /&gt;
        circle.setEffect(new Lighting());&lt;br /&gt;
        //create a text inside a circle&lt;br /&gt;
        final Text text = new Text (i.toString());&lt;br /&gt;
        text.setStroke(Color.BLACK);&lt;br /&gt;
        //create a layout for circle with text inside&lt;br /&gt;
        final StackPane stack = new StackPane();&lt;br /&gt;
        stack.getChildren().addAll(circle, text);&lt;br /&gt;
        stack.setLayoutX(30);&lt;br /&gt;
        stack.setLayoutY(30);&lt;br /&gt;
 &lt;br /&gt;
        p.getChildren().add(stack);&lt;br /&gt;
        stage.show();&lt;br /&gt;
 &lt;br /&gt;
        //create a timeline for moving the circle&lt;br /&gt;
        timeline = new Timeline();&lt;br /&gt;
        timeline.setCycleCount(Timeline.INDEFINITE);&lt;br /&gt;
        timeline.setAutoReverse(true);&lt;br /&gt;
 &lt;br /&gt;
//You can add a specific action when each frame is started.&lt;br /&gt;
        timer = new AnimationTimer() {&lt;br /&gt;
            @Override&lt;br /&gt;
            public void handle(long l) {&lt;br /&gt;
                text.setText(i.toString());&lt;br /&gt;
                i++;&lt;br /&gt;
            }&lt;br /&gt;
 &lt;br /&gt;
        };&lt;br /&gt;
 &lt;br /&gt;
        //create a keyValue with factory: scaling the circle 2times&lt;br /&gt;
        KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);&lt;br /&gt;
        KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);&lt;br /&gt;
 &lt;br /&gt;
        //create a keyFrame, the keyValue is reached at time 2s&lt;br /&gt;
        Duration duration = Duration.millis(2000);&lt;br /&gt;
        //one can add a specific action when the keyframe is reached&lt;br /&gt;
        EventHandler onFinished = new EventHandler&amp;lt;ActionEvent&amp;gt;() {&lt;br /&gt;
            public void handle(ActionEvent t) {&lt;br /&gt;
                 stack.setTranslateX(java.lang.Math.random()*200-100);&lt;br /&gt;
                 //reset counter&lt;br /&gt;
                 i = 0;&lt;br /&gt;
            }&lt;br /&gt;
        };&lt;br /&gt;
 &lt;br /&gt;
  KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);&lt;br /&gt;
 &lt;br /&gt;
        //add the keyframe to the timeline&lt;br /&gt;
        timeline.getKeyFrames().add(keyFrame);&lt;br /&gt;
 &lt;br /&gt;
        timeline.play();&lt;br /&gt;
        timer.start();&lt;br /&gt;
    }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
    public static void main(String[] args) {&lt;br /&gt;
        Application.launch(args);&lt;br /&gt;
    }&lt;br /&gt;
  } &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>George2</name></author>	</entry>

	</feed>