问题描述
在 EDC 中,我可以使用 select t.*,(1 + sum( (event_type = 'end')::int ) over () -
sum( (event_type = 'end')::int ) over (order by event_time desc)
) as group_id
from t
order by event_time;
中的 script
来制作动画:
collections/group
如果我调用 group { "my_group";
script {
public my_anim(val,Float:pos) {
set_tween_state(PART:"elm.text",pos,"state_begin",0.0,"state_end",0.0);
}
public start_my_anim() {
anim(1 /*duration in seconds*/,"my_anim",1 /*I have no idea about this param*/);
}
}
parts {
text { "elm.text";
desc { "state_begin";
...
}
desc { "state_end";
...
}
}
}
}
,它会为我的文本设置动画,太棒了!
但它会以 LINEAR 过渡动画。我如何要求 start_my_anim
使用 DECELERATE?
解决方法
您可以使用 set_tween_state_anim() 代替 set_tween_state(),如下所示。
set_tween_state_anim(PART:"elm.text","state_begin",0.0,"state_end",DECELERATE,pos);
//There are some transition modes. (e.g. LINEAR,ACCELERATE,etc.)
顺便说一句,anim() 的最后一个参数是作为脚本函数的值参数传递的。
public my_anim(val,Float:pos) {
if (val == 9) { // This is the last parameter of anim function.
set_tween_state(PART:"elm.text",pos,0.0);
}
}
public start_my_anim() {
anim(1,"my_anim",9); // The last parameter is passed as the value parameter of the script function.
}
谢谢。