package mov1; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.CustomNode; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.shape.Circle; import javafx.scene.paint.Color; import javafx.animation.Timeline; import javafx.animation.KeyFrame; import javafx.animation.Interpolator; import javafx.ext.swing.SwingSlider; import javafx.scene.transform.Translate; class bola extends CustomNode { public var CX:Number; public var CY:Number; public var V:Number=100; public override function create(): Node { return Group { content: [ Circle { centerX: bind CX, centerY: bind CY radius: 50 fill: Color.BLACK } ] }; } init{ var timeline=Timeline { repeatCount: Timeline.INDEFINITE keyFrames : [ KeyFrame {time: 0s values:[CX => 50 CY => 50]} KeyFrame {time: 2s values:[CX => 50 CY => 450 tween Interpolator.LINEAR]} KeyFrame {time: 4s values:[CX => 450 CY => 450 tween Interpolator.LINEAR]} KeyFrame {time: 6s values:[CX => 450 CY => 50 tween Interpolator.LINEAR]} KeyFrame {time: 8s values:[CX => 50 CY => 50 tween Interpolator.LINEAR]} ] } timeline.play(); } } Stage { title: "MyApp" onClose: function(){ java.lang.System.exit(0); } scene: Scene { width: 500 height: 500 content: [bola{}] } }
Buscar este blog
lunes, 8 de diciembre de 2008
Ejemplo Animacion en JavaFX
Aqui un pequeño ejemplo de animacion en javaFX, se trata de un circulo que recorre la ventana.
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario