@Override
    public void setTimelineEvent(){
        KeyFrame kf = new KeyFrame(Duration.millis(17), new EventHandler<ActionEvent>(){
            public void handle(ActionEvent e){
                if(soundWaves[INDEX_ZERO].getRadius() >= observer.getCenterX()-source.getCenterX()){
                    if(observer.getCenterX() > source.getCenterX()+source.getTranslateX()){
                        observedFrequency = ((340+observerVelocity*200)/(340-sourceVelocity*200))*(1/(Double.parseDouble(inputFrequency_doppler.getText())/100));
                        graph.addDataToSeries(time, 40 * Math.sin(Math.PI * 2 * observedFrequency * time), 0.02);
                        time+=INIT_TIME;
                    }else if(observer.getCenterX() < source.getCenterX()+source.getTranslateX()){
                        observedFrequency = ((340-observerVelocity*200)/(340+sourceVelocity*200))*(1/(Double.parseDouble(inputFrequency_doppler.getText())/100));
                        graph.addDataToSeries(time, 40 * Math.sin(Math.PI * 2 * observedFrequency * time), 0.02);
                        time+=INIT_TIME;
                    }
                }else{
                    graph.addDataToSeries(time, 0, 0.02);
                    time+=INIT_TIME;
                }     
                if(sourceTranslateIndex+source.getCenterX() < (int)(1021-sourceVelocity)){
                    source.setTranslateX(sourceTranslateIndex);
                    sourceTranslateIndex = Double.parseDouble(df_1.format(sourceVelocity+sourceTranslateIndex));
                    if(observerTranslateIndex+observer.getCenterX() > (int)(31+observerVelocity)){
                        observer.setTranslateX(observerTranslateIndex);
                        observerTranslateIndex = Double.parseDouble(df_1.format(observerTranslateIndex-observerVelocity));
                    }
                }else{
                    fade+=fadeRate;
                }
                for(int i=0; i<waveIndex; i++){
                    if(soundWaves[i].getStrokeWidth() < 0.15){
                        if(root_doppler.getChildren().contains(soundWaves[i]))
                            root_doppler.getChildren().remove(soundWaves[i]);
                    }
                    soundWaves[i].setRadius(soundWaves[i].getRadius()+1.7);
                    soundWaves[i].setStrokeWidth(1.5-(fade*(sourceTranslateIndex-(i*refreshRate))));
                }
                if(sourceTranslateIndex%refreshRate == 0){
                    produceSoundWave((int)(sourceTranslateIndex/refreshRate));
                }
            }
        });
        
        dopplerAnimationTimeline.setCycleCount(Timeline.INDEFINITE);
        dopplerAnimationTimeline.getKeyFrames().add(kf);        
    }