Skip to content

Commit b348d1a

Browse files
committed
PropertyAnimation: Make iteration-count: n run animations n times
Side-effect: The code handles invalid inputs to duration/delay better.
1 parent b4f689c commit b348d1a

File tree

6 files changed

+367
-75
lines changed

6 files changed

+367
-75
lines changed

docs/langref.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ Animation can be configured with the following parameter:
678678

679679
* `delay`: the amount of time to wait before starting the animation
680680
* `duration`: the amount of time it takes for the animation to complete
681-
* `loop-count`: FIXME
681+
* `iteration-count`: The number of times a animation should run. A negative value specifies
682+
infinite reruns. Fractual values are possible.
682683
* `easing`: can be `linear`, `ease`, `ease-in`, `ease-out`, `ease-in-out`, `cubic-bezier(a, b, c, d)` as in CSS
683684

684685
It is also possible to animate several properties with the same animation:

internal/compiler/builtins.60

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ PropertyAnimation := _ {
408408
property <duration> delay;
409409
property <duration> duration;
410410
property <easing> easing;
411-
property <int> loop-count;
411+
property <float> iteration-count: 1.0;
412412
//-is_non_item_type
413413
}
414414

internal/compiler/llr/lower_expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ pub fn lower_animation(a: &PropertyAnimation, ctx: &ExpressionContext<'_>) -> An
370370
fn animation_fields() -> impl Iterator<Item = (String, Type)> {
371371
IntoIterator::into_iter([
372372
("duration".to_string(), Type::Int32),
373-
("loop-count".to_string(), Type::Int32),
373+
("iteration-count".to_string(), Type::Float32),
374374
("easing".to_string(), Type::Easing),
375375
("delay".to_string(), Type::Int32),
376376
])

internal/core/items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ pub struct PropertyAnimation {
988988
#[rtti_field]
989989
pub duration: i32,
990990
#[rtti_field]
991-
pub loop_count: i32,
991+
pub iteration_count: f32,
992992
#[rtti_field]
993993
pub easing: crate::animations::EasingCurve,
994994
}

0 commit comments

Comments
 (0)