在 EDC 脚本中将转换从线性更改为减速

问题描述

在 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.
}

谢谢。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...