Clock

Clock[]

represents a clock variable whose value cycles continuously from 0 to 1 once per second when it appears inside a dynamically updated object such as a Dynamic.

Clock[t]

cycles from 0 to t every t seconds.

Clock[vmax,t]

cycles from 0 to vmax every t seconds.

Clock[{vmin,vmax},t]

cycles through the range vmin to vmax every t seconds.

Clock[{vmin,vmax}]

cycles through the range vmin to vmax over the course of vmax-vmin seconds.

Clock[{vmin,vmax,dv}]

cycles from vmin to vmax in steps of dv, spending dv seconds at each value.

Clock[{vmin,vmax,dv},t]

cycles from vmin to vmax in steps dv every t seconds.

Clock[vals,t,n]

goes through the cycle only n times, then always yields only the maximum value.

Details

  • The base for all times used by Clock is the creation time of the cell in which Clock appears.
  • Clock[Infinity] gives a value that ranges from to at a rate of one unit per second.
  • Clock[{vmin,Infinity}] gives a value that ranges from vmin to at a rate of one unit per second.
  • Clock[{vmin,Infinity,dv}] ranges from vmin to in steps of dv, spending dv seconds at each value.

Examples

open allclose all

Basic Examples  (2)

Create a clock value that cycles continuously from 0 to 1 once per second:

In[1]:=
Click for copyable input
Out[1]=

Use Clock to trigger updates for some time interval:

In[1]:=
Click for copyable input
Out[1]=

Scope  (7)

Properties & Relations  (1)

Possible Issues  (1)

See Also

AbsoluteTime  SessionTime  Animator  Refresh  RandomReal

Tutorials

Introduced in 2007
(6.0)