Fix light demo exception when closing the window while the demo is playing
[scilab.git] / scilab / modules / graphics / demos / lighting / rot_light.dem.sce
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2013 - Pedro SOUZA
3 //
4 // This file is released under the 3-clause BSD license. See COPYING-BSD.
5
6
7 function demo_rot_light()
8
9     my_handle = scf(100001);
10     clf(my_handle,"reset");
11     demo_viewCode("rot_light.dem.sce");
12
13     // DEMO START
14     my_plot_desc          = "Rotating light";
15     my_handle.figure_name = my_plot_desc;
16
17     plot3d;
18     l=light();
19     s=gce();
20
21     try
22         for i=0:2000
23             sleep(5);
24             x = 2*cos(i*%pi/180);
25             y = 2*sin(i*%pi/180);
26             z = 2;
27             l.position = [x y z];
28         end
29     catch
30     end
31     // DEMO END
32 endfunction
33
34
35 demo_rot_light();
36 clear demo_rot_light;
37