X

Vaibhav's Blog Space

  • Java
    September 6, 2008

Guassian Blur Example JavaFX

Guest Author

This is one simulation of Golden Eyes :-D(with an ugly face). I tried to make one use of Gaussian Blur which is applied in the white color of eyes. Adding this spot in the eyes gives a real simulation.

Here is the simple code :

package eyes;
import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.geometry.Arc;
import javafx.scene.geometry.\*;
import javafx.scene.paint.Color;
import javafx.scene.paint.\*;
import javafx.scene.effect.\*;
var y: Number = 150;
Frame {
    title: "Golden Eyes"
    width: 500
    height: 500
    closeAction: function() { java.lang.System.exit( 0 );
    }
    visible: true
    stage: Stage {
        fill: Color.GRAY;
        content: [ 
            Circle {
                centerX: 160, centerY: y
                radius: 23
                fill: LinearGradient {
                    startX: 0.0
                    startY: 0.0
                    endX: 1.0
                    endY: 0.0
                    proportional: true
                    stops: [
                        Stop { offset: 0.0 color: Color.GOLD },
                        Stop { offset: 1.0 color: Color.BLACK }
                    ]
                }
                opacity: 0.9
            },
            Circle {
                centerX: 160, centerY: y
                radius: 10
                fill: Color.BLACK
            },
            Circle {
                centerX: 166, centerY: y - 5
                radius: 5
                fill: Color.WHITE;
                effect : GaussianBlur {
                    radius: 6
                }
            },
            Circle {
                centerX: 250, centerY: y
                radius: 23
                fill: LinearGradient {
                    startX: 0.0
                    startY: 0.0
                    endX: 1.0
                    endY: 0.0
                    proportional: true
                    stops: [
                        Stop { offset: 0.0 color: Color.BLACK },
                        Stop { offset: 1.0 color: Color.GOLD }
                    ]
                }
                opacity: 0.2
            },

            Circle {
                centerX: 250, centerY: y
                radius: 10
                fill: Color.BLACK
            },
            Circle {
                centerX: 244, centerY: y - 5
                radius: 5
                fill: Color.WHITE;
                effect : GaussianBlur {
                    radius: 6
                }
            },
            Circle {
                centerX: 200, centerY: 180
                radius: 100
                fill: Color.SIENNA
                opacity: 0.1
            },
            Polyline {
             stroke:Color.BLACK
                points: [
                    200,160,
                    220.0,220.0,
                    180.0,220.0
                ]
            },
            Path {
               fill: LinearGradient {
                    startX: 0.0
                    startY: 0.0
                    endX: 1.0
                    endY: 0.0
                    proportional: true
                    stops: [
                        Stop { offset: 0.0 color: Color.BLACK },
                        Stop { offset: 1.0 color: Color.RED }
                    ]
                }
                elements: [
                    MoveTo { x: 160 y: 240 },
                    ArcTo { x: 250 y: 240 radiusX: 100 radiusY: 100},
                ]
            },
       ]
    }
}

Join the discussion

Comments ( 4 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.