# Sequence Interval with a Parallel loop

Hello,

My plan was to move my camera around my scene, to random points, starting and stopping smoothly; and keep the camera pointed towards the center.

``````def face( ):
base.cam.lookAt( 0, 0, 0 )
print 'face'

def next( ):
p1= ran.uniform( -5, 5 ), ran.uniform( -10, 0 ), ran.uniform( -5, 5 )
i= LerpPosInterval( base.cam, 5, p1, blendType= 'easeInOut' )
j= Func( next )
k= Sequence( i, j )
m= Func( face )
n= Parallel( k, m )
n.start( )
next( )``````

But, ‘m’, which is ‘Func( face )’ only runs once! I need m to loop, and stop when k stops (actually, possibly ‘i’…). But also, I learned from trying with taskMgr, I need ‘face’ to occur after ‘i’ every frame, I believe; I was getting a jitter without controlling that order.

Func() only calls its function once, by design. If you want a function that gets called repeatedly over a period of time in an interval, try LerpFunc(). The function called by LerpFunc() must be written to accept a parameter, t, which ranges from 0 to 1 (or whatever specified range) over the lerp’s duration (which must be explicitly specified with duration = x).

David

That seems “non-optimal” but quite adequate. Can I retrieve the duration I used on the 1st for setting the 2nd, such as from an attribute, or do I need to… Ick!.. declare a variable?

You need to declare a variable. In general, you’re responsible for knowing the structure of the intervals you’re constructing.

David

Your reverse psychology won’t work on me.

``	m= LerpFunc( face, duration= i.getDuration( ) )``

Seems to have done the job.

I think the combination of Parallels and Funcs calls for an exception. If a Func is in a Parallel with other non-Func arguments, the Funcs should have the option to repeat.

This would have a benefit IMO, but I’m new, so I can’t attest to what the costs are.