Here is the .gmk(GM7) that I was using for testing this:
Download from Host-A.net
Download Size: 24KB
Here is my code for interpolating the ds_grid I have set up for keyframes:
//interpolate(current_frame,ds_grid,column_number)
var frame1,frame2,val1,val2,i;
frame2=0
i=0
while frame2<argument0
{
i+=1
frame2=ds_grid_get(argument1,0,i)
val2=ds_grid_get(argument1,argument2,i)
}
frame1=ds_grid_get(argument1,0,i-1)
val1=ds_grid_get(argument1,argument2,i-1)
if i>0
{
return (val1+((argument0-frame1)/(frame2-frame1))*(val2-val1))
}
else
{
return ds_grid_get(argument1,argument2,0)
}And, here is the draw code I'm using to display the information:
var xx,yy;
for (xx=0;xx<ds_grid_width(keyframes);xx+=1)
{
for (yy=0;yy<ds_grid_height(keyframes);yy+=1)
{
draw_text(128+xx*24,yy*24,string(ds_grid_get(keyframes,xx,yy)))
}
}
draw_text(0,0,string(fps))
var d1, d2, d3;
for (i=0;i<=animation_length;i+=1)
{
d1=interpolate(i,keyframes,1)
draw_text(320,i*20,string(i)+" "+string(d1))
}And this is the result:

On the left is the ds_grid data with the keyframes on the left column and the data on the remaining columns. On the right is the interpolated data. As you can see, the interpolation works, but, given the framerate displayed on the upper left, I don't think it's terribly efficient.
Here are my two questions I pose to you:
1) What's a more efficient interpolation method?
2) What's an efficient method for spline-based interpolation? (Wiki Link for Spline-Base Interpolation)
Thanks ahead of time, again.
Best,
Riley
Old Post:
Edited by Chessmasterriley, 23 August 2012 - 12:05 AM.













