In EDC, I can use script
s in collections/group
to make animation:
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";
...
}
}
}
}
If I call start_my_anim
, it will animate my text, great!
But it will animate with LINEAR transition. How can I ask anim
to use DECELERATE?
You can use set_tween_state_anim() instead of set_tween_state() as follows.
set_tween_state_anim(PART:"elm.text", "state_begin", 0.0, "state_end", 0.0, DECELERATE, pos);
//There are some transition modes. (e.g. LINEAR, ACCELERATE, DECELERATE, etc.)
BTW, the last parameter of anim() is passed as the value parameter of the script function.
public my_anim(val, Float:pos) {
if (val == 9) { // This is the last parameter of anim function.
set_tween_state(PART:"elm.text", pos, "state_begin", 0.0, "state_end", 0.0);
}
}
public start_my_anim() {
anim(1, "my_anim", 9); // The last parameter is passed as the value parameter of the script function.
}
Thank you.