Vizard 7 » Command Index » Vizard modules » vizact » <vizact>.mix
7.3

<vizact>.mix

Create a mix parameter for blending between two values

<vizact>.mix(  
begin  
end  
time = None  
speed = None  
interpolate = vizact.linear  
)  
begin
The begin value for mixing
end
The end value for mixing
time = None
The amount of time to mix from begin to end values
speed = None
The speed to mix between the begin end values
interpolate = vizact.linear
The interpolation method to use when performing the action. Can be one of the following interpolation methods, or None to use linear.

Interpolation method

vizact.linear

Linear interpolation. Animation will occur at a constant speed.

vizact.cubic

Cubic interpolation. The default control points are 0.1 and 0.9, which causes a slight easing in and out of the animation. You can specify different control points by creating an instance and passing the values into the constructor (e.g. vizact.cubic(0.1,1.1))

vizact.easeIn
vizact.easeOut
vizact.easeInOut

An alias for quadratic easing.

vizact.easeInStrong
vizact.easeOutStrong
vizact.easeInOutStrong

An alias for quintic easing.

vizact.easeInQuadratic
vizact.easeOutQuadratic
vizact.easeInOutQuadratic

Use quadratic (x^2) easing when going in and/or out of animation.

vizact.easeInCubic
vizact.easeOutCubic
vizact.easeInOutCubic

Use cubic (x^3) easing when going in and/or out of animation.

vizact.easeInQuartic
vizact.easeOutQuartic
vizact.easeInOutQuartic

Use quartic (x^4) easing when going in and/or out of animation.

vizact.easeInQuintic
vizact.easeOutQuintic
vizact.easeInOutQuintic

Use quintic (x^5) easing when going in and/or out of animation.

vizact.easeInSine
vizact.easeOutSine
vizact.easeInOutSine

Use sinusoidal (sin(x)) easing when going in and/or out of animation.

vizact.easeInExp
vizact.easeOutExp
vizact.easeInOutExp

Use exponential (2^x) easing when going in and/or out of animation.

vizact.easeInCircular
vizact.easeOutCircular
vizact.easeInOutCircular

Use circular (sqrt(x)) easing when going in and/or out of animation.

vizact.backIn
vizact.backOut
vizact.backInOut

Back up in opposite direction when going in and/or out of animation.

vizact.bounceIn
vizact.bounceOut
vizact.bounceInOut

Bounce when going in and/or out of animation.

Remarks

This command creates a mix object which can be used with the following commands to call an arbitrary function with an animated parameter:

<vizact>.call
<vizact>.method.[name]
<viztask>.waitCall

When a mix parameter is passed to these commands, the specified function will be called every frame for a given duration (depending on the time or speed values), starting at the begin value and stopping at the end value.

Return Value

vizact.mix object

Example

Example 1:
import viz
import vizact
viz.go()

model = viz.add('logo.ive',pos=(0,1,4))

# Spin 90 degrees
spin = vizact.spinTo(euler=(90,0,0),time=1.0)

# Fade clear color to white
black_to_white = vizact.mix(viz.BLACK,viz.WHITE,time=2.0,interpolate=vizact.easeOutStrong)
color = vizact.call(viz.clearcolor,black_to_white)

# Add spin/fade actions as a sequence
action = vizact.sequence(spin,color)
model.runAction(action)


Example 2:
import viz
import viztask
viz.go()

viz.add('dojo.osgb')

def ZoomTask():

    viz.fov(60)

    zoom_in = vizact.mix(60, 20, time=0.5, interpolate=vizact.easeOutStrong)
    zoom_out = vizact.mix(20, 60, time=0.5, interpolate=vizact.easeOutStrong)

    while True:

        yield viztask.waitKeyDown(' ')

        yield viztask.waitCall(viz.fov,zoom_in)

        yield viztask.waitKeyDown(' ')

        yield viztask.waitCall(viz.fov,zoom_out)


viztask.schedule( ZoomTask() )

See also

<vizact>.call
<vizact>.method.[name]
<viztask>.waitCall