public void setSpeed(double speed) {
        if (speed >= 0 && speed <= 100) {
            this.speed = speed;

            if (model.isPlaying() && animationTask != null) {
                animationTask.cancel();
                animationTask = new AnimationTask(this);

                if (speed > 0) {
                    animationTimer.scheduleAtFixedRate(animationTask, 0,
                            (long) (1000d / speed));
                }
            }
        }
    }