-
I created a global which there's a field called export global Animator {
in-out property <duration> animation-duration: 120ms;
in-out property <duration> ripple-animation-duration: 2s;
} This property has a setter, that receives a Here's the code: // Animator::set_animation_duration(value: i64)
animator.set_animation_duration(120); // 120 milliseconds? 120 seconds? 120 what? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, this is milliseconds. Documented there: https://releases.slint.dev/1.8.0/docs/rust/slint/docs/type_mappings/
That is a very good question. The reason is that we can't use We could have made so that we use |
Beta Was this translation helpful? Give feedback.
Yes, this is milliseconds. Documented there: https://releases.slint.dev/1.8.0/docs/rust/slint/docs/type_mappings/
That is a very good question. The reason is that we can't use
std::time::Duration
as field of a generated struct or property because it is notrepr(C)
and because we also support other language like C++, it needs to be binary compatible.We could have made so that we use
std::time::Duration
for things that are only exposed to rust, and u64 for things that needs to be shared, but unfortunately we didn't do that before Slint 1.0. (Would have made things more complicated)