def anim(self, duration, offset=<NUM_LIT:0>, timestep=<NUM_LIT:1>,<EOL>label=None, unit=None,<EOL>time_fn=param.Dynamic.time_fn):
frames = (duration // timestep) + <NUM_LIT:1><EOL>if duration % timestep != <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if label is None:<EOL><INDENT>label = time_fn.label if hasattr(time_fn, '<STR_LIT:label>') else '<STR_LIT>'<EOL><DEDENT>unit = time_fn.unit if (not unit and hasattr(time_fn, '<STR_LIT>')) else unit<EOL>vmap = HoloMap(kdims=[Dimension(label, unit=unit if unit else '<STR_LIT>')])<EOL>self.state_push()<EOL>with time_fn as t:<EOL><INDENT>t(offset)<EOL>for i in range(frames):<EOL><INDENT>vmap[t()] = self[:]<EOL>t += timestep<EOL><DEDENT><DEDENT>self.state_pop()<EOL>return vmap<EOL>
duration: The temporal duration to animate in the units
defined on the global time function.

offset: The temporal offset from which the animation is
generated given the supplied pattern

timestep: The time interval between successive frames. The
duration must be an exact multiple of the timestep.

label: A label string to override the label of the global time
function (if not None).

unit: The unit string to override the unit value of the global
time function (if not None).

time_fn: The global time function object that is shared across
the time-varying objects that are being sampled.

Note that the offset, timestep and time_fn only affect
patterns parameterized by time-dependent number
generators. Otherwise, the frames are generated by successive
call to the pattern which may or may not be varying (e.g to
view the patterns contained within a Selector).