此函数可用于创建要添加到动画曲线通道的新点 (posx, value)结构。
创建点时,结构为空,您需要设置以下变量来生成点数据:
动画曲线点结构 | ||
---|---|---|
变量名 | 数据类型 | 描述 |
posx | real | 点的时间位置 (从0到1归一化)。 |
value | real | 点的值。 |
您创建的每个点结构都应添加到数组中,这是添加到动画曲线通道结构 “通道” 变量中的数组 (如下例所示)。
animcurve_point_new();
my_curve = animcurve_create();
my_curve.name = "My_Curve";
var _channels = array_create(1);
_channels[0] = animcurve_channel_new();
_channels[0].name = "alpha";
_channels[0].type = animcurvetype_catmullrom;
_channels[0].iterations = 8;
var _points = array_create(3);
_points[0] = animcurve_point_new();
_points[0].posx = 0;
_points[0].value = 0;
_points[1] = animcurve_point_new();
_points[1].posx = 0.5;
_points[1].value = 1;
_points[2] = animcurve_point_new();
_points[2].posx = 1;
_points[2].value = 0;
_channels[0].points = _points;
my_curve.channels = _channels;
上面的代码创建了一个新的动画曲线结构,并将其存储在变量 “my_curve” 中。然后用名称和通道数组填充此结构。通道阵列包含具有三个点的单个通道。