function view_frames ( frame_max )

%*****************************************************************************80
%
%% view_frames() views the frames of an animatione, stored in files.
%
%  Discussion:
%
%    This program views JPEG files of index 0 through frame_max, which constitute
%    individual frames of an animation.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 November 2010
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer frame_max, the index of the last frame to view.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'VIEW_FRAMES:\n' );
  fprintf ( 1, '  View the images contained in a sequence of files.\n' );

  if ( nargin < 1 )
    fprintf ( 1, '\n' );
    frame_max = input ( 'Enter the index of the last frame to view:  ' );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  View frames 0 through %d.\n', frame_max );
  fprintf ( 1, '  First frame is in "%s",\n', sprintf ( 'frame%04d.jpg', 0 ) );
  fprintf ( 1, '  Last  frame is in "%s".\n', sprintf ( 'frame%04d.jpg', frame_max ) );

  for frame_id = 0 : frame_max
    view_frame ( frame_id );
    pause ( 2 );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, 'view_frames:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
 
