1 ## Copyright (C) 2005-2012 Etienne Grossmann <etienne@egdn.net>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
16 ## s = vrml_anim (typ, val, eventin, time)
19 ## - an interpolator of type typ, with values val
20 ## - a TimeSensor with period time
21 ## and route the event to eventin
23 function [s,tname] = vrml_anim (typ, val, eventin, key, period)
25 if nargin < 4, key = [0 1]; end
26 if nargin < 5, period = 5; end
28 iname = vrml_newname ();
30 si = vrml_interp (typ, val,"key",key, "DEF",iname);
32 tname = vrml_newname ();
33 st = vrml_TimeSensor ("cycleInterval",period,"loop",1,"DEF",tname);
35 else # Use previously declared TimeSensor
40 sr = vrml_ROUTE ([tname,".fraction_changed"],[iname,".set_fraction"]);
41 sr2 = vrml_ROUTE ([iname,".value_changed"],eventin);
43 s = [si, st, sr, sr2];