scheduleInterpolateTask

Schedule a task to interpolate a property over a period of time.

  1. UUID scheduleInterpolateTask(ref T val, T start, T end, Duration duration, T function(T, T, float) interpFunc = &lerp!(T))
  2. UUID scheduleInterpolateTask(ref Owner own, T start, T end, Duration duration, T function(T, T, float) interpFunc = &lerp!(T))
    UUID
    scheduleInterpolateTask
    (
    string prop
    T
    Owner
    )
    (
    ref Owner own
    ,,
    T end
    ,
    Duration duration
    ,
    T function(
    T
    ,
    T
    ,
    float
    )
    interpFunc = &lerp!(T)
    )
    if (
    __traits(compiles, mixin ("own." ~ prop))
    )

Parameters

prop

The name of the property being interpolated.

T

The type to interpolate, either vector or quaternion.

Owner

The type that owns the property interpolating.

own
Type: Owner

ref The owner of the property.

start
Type: T

The starting value for interpolation.

end
Type: T

The target value for interpolation.

interpFunc
Type: T function(
T
,
T
,
float
)

[default=lerp] The function to use for interpolation.

Return Value

Type: UUID

The ID of the task.

Examples

scheduleInterpolateTask!q{position}( transform, startNode, endNode, 100.msecs );
1 import std.stdio;
2 
3 writeln( "Dash Tasks scheduleInterpolateTask unittest 2" );
4 
5 auto testClass = new TestPropertyInterpolate;
6 testClass.vector = vec3f( 0, 0, 0 );
7 vec3f start = vec3f( 0, 1, 0 );
8 vec3f end = vec3f( 0, 1, 1 );
9 scheduleInterpolateTask!q{vector}( testClass, start, end, 100.msecs );
10 
11 while( scheduledTasks.length )
12 {
13     executeTasks();
14     Time.update();
15 }
16 
17 assert( testClass.vector == end );

Meta