[ hepek87 @ 30.12.2012. 11:43 ] @
Kako kreirati kucajuce srce u JavaFX-u? Korisnik treba da može da podesi broj otkucaja srca (između 50 i 150 otkucaja)? Najbliže što sam došao je samo kreiranje oblika sličnog srcu koristeći kombinaciju tri kruga, odnosno slijedeći kod: Code: package srce; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.ShapeIntersect; import javafx.scene.effect.Reflection; import javafx.scene.paint.LinearGradient; import javafx.scene.paint.Stop; def shapeintersect = ShapeIntersect { a: Circle { centerX: 60 centerY: 60 radius: 30 fill: Color.YELLOW opacity: 0.5 } b: [ Circle { centerX: 45 centerY: 85.98 radius: 30 fill: Color.INDIANRED opacity: 0.5 }, Circle { centerX: 75 centerY: 85.98 radius: 30 fill: Color.BLUE opacity: 0.5 } ] fill: LinearGradient { startX: 0.5, startY: 0.0, endX: 1.0, endY: 1.0 proportional: true stops: [ Stop { offset: 0.0 color: Color.CRIMSON } Stop { offset: 1.0 color: Color.DARKRED } ] } } Stage { title: "Srce" scene: Scene { width: 190 height: 250 content: shapeintersect } } |