mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
Fixed transition-in animations with delay
commit_hash:72a4b9e75ae140a1361ce5cdd45f14d8e1456324
This commit is contained in:
@@ -20846,6 +20846,7 @@
|
||||
"test_data/regression_test_data/animations/scale_pivot_src.json":"divkit/public/test_data/regression_test_data/animations/scale_pivot_src.json",
|
||||
"test_data/regression_test_data/animations/tab_titles_animations.json":"divkit/public/test_data/regression_test_data/animations/tab_titles_animations.json",
|
||||
"test_data/regression_test_data/animations/transient_div_with_clip_and_shadow.json":"divkit/public/test_data/regression_test_data/animations/transient_div_with_clip_and_shadow.json",
|
||||
"test_data/regression_test_data/animations/transition-animations-with-delay.json":"divkit/public/test_data/regression_test_data/animations/transition-animations-with-delay.json",
|
||||
"test_data/regression_test_data/animations/transition/change_bounds_diff_ids_dst.json":"divkit/public/test_data/regression_test_data/animations/transition/change_bounds_diff_ids_dst.json",
|
||||
"test_data/regression_test_data/animations/transition/change_bounds_diff_ids_src.json":"divkit/public/test_data/regression_test_data/animations/transition/change_bounds_diff_ids_src.json",
|
||||
"test_data/regression_test_data/animations/transition/change_bounds_diff_sizes_dst.json":"divkit/public/test_data/regression_test_data/animations/transition/change_bounds_diff_sizes_dst.json",
|
||||
|
||||
+2
@@ -179,9 +179,11 @@ final class DetachableAnimationBlockView: BlockView, DelayedVisibilityActionView
|
||||
return
|
||||
}
|
||||
|
||||
childView.isHidden = true
|
||||
let minDelay = animationIn.sortedChronologically().first?.delay ?? 0
|
||||
|
||||
let item = DispatchWorkItem { [weak self] in
|
||||
childView.isHidden = false
|
||||
childView.setInitialParamsAndAnimate(
|
||||
animations: animationIn.withDelay(-minDelay),
|
||||
completion: { [weak self] in
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"templates": {
|
||||
"button": {
|
||||
"type": "text",
|
||||
"paddings": {
|
||||
"left": 16,
|
||||
"top": 16,
|
||||
"right": 16,
|
||||
"bottom": 16
|
||||
},
|
||||
"margins": {
|
||||
"left": 24,
|
||||
"right": 24
|
||||
},
|
||||
"border": {
|
||||
"corner_radius": 8
|
||||
},
|
||||
"background": [
|
||||
{
|
||||
"type": "solid",
|
||||
"color": "#0E000000"
|
||||
}
|
||||
],
|
||||
"font_size": 14,
|
||||
"font_weight": "medium",
|
||||
"text_alignment_vertical": "center",
|
||||
"text_alignment_horizontal": "center",
|
||||
"text_color": "#000000"
|
||||
},
|
||||
"in_out_transition_demo_block": {
|
||||
"type": "text",
|
||||
"height": {
|
||||
"type": "fixed",
|
||||
"value": 88
|
||||
},
|
||||
"margins": {
|
||||
"left": 24,
|
||||
"right": 24,
|
||||
"bottom": 8
|
||||
},
|
||||
"border": {
|
||||
"corner_radius": 16
|
||||
},
|
||||
"background": [
|
||||
{
|
||||
"type": "solid",
|
||||
"color": "#3F28C3"
|
||||
}
|
||||
],
|
||||
"text_color": "#ffffff",
|
||||
"font_size": 14,
|
||||
"text_alignment_vertical": "center",
|
||||
"text_alignment_horizontal": "center"
|
||||
}
|
||||
},
|
||||
"card": {
|
||||
"variables": [
|
||||
{
|
||||
"name": "change_state",
|
||||
"type": "string",
|
||||
"value": "none"
|
||||
},
|
||||
{
|
||||
"name": "scale_state",
|
||||
"type": "string",
|
||||
"value": "invisible"
|
||||
}
|
||||
],
|
||||
"variable_triggers": [
|
||||
{
|
||||
"condition": "@{change_state == 'scale' && scale_state == 'visible'}",
|
||||
"mode": "on_variable",
|
||||
"actions": [
|
||||
{
|
||||
"log_id": "update change_state",
|
||||
"url": "div-action://set_variable?name=change_state&value=none"
|
||||
},
|
||||
{
|
||||
"log_id": "update scale_state",
|
||||
"url": "div-action://set_variable?name=scale_state&value=invisible"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "@{change_state == 'scale' && scale_state != 'visible'}",
|
||||
"mode": "on_variable",
|
||||
"actions": [
|
||||
{
|
||||
"log_id": "update change_state",
|
||||
"url": "div-action://set_variable?name=change_state&value=none"
|
||||
},
|
||||
{
|
||||
"log_id": "update scale_state",
|
||||
"url": "div-action://set_variable?name=scale_state&value=visible"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"log_id": "sample_card",
|
||||
"states": [
|
||||
{
|
||||
"state_id": 0,
|
||||
"div": {
|
||||
"type": "container",
|
||||
"orientation": "vertical",
|
||||
"margins": {
|
||||
"top": 24,
|
||||
"bottom": 24
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"type": "in_out_transition_demo_block",
|
||||
"id": "scale_in_out",
|
||||
"text": "",
|
||||
"visibility": "@{scale_state}",
|
||||
"transition_out": {
|
||||
"start_delay": 300,
|
||||
"type": "scale",
|
||||
"duration": 1000
|
||||
},
|
||||
"transition_in": {
|
||||
"start_delay": 300,
|
||||
"type": "scale",
|
||||
"duration": 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"alignment_horizontal": "center",
|
||||
"text": "Test Button",
|
||||
"actions": [
|
||||
{
|
||||
"log_id": "set_state",
|
||||
"url": "div-action://set_variable?name=change_state&value=scale"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,20 @@
|
||||
{
|
||||
"tests": [
|
||||
{
|
||||
"title": "Transition animations with delay",
|
||||
"tags": [
|
||||
"Animations"
|
||||
],
|
||||
"steps": [
|
||||
"Tap \"Test Button\"",
|
||||
"Tap \"Test Button\" again"
|
||||
],
|
||||
"expected_results": [
|
||||
"The purple rectangle should appear animatedly",
|
||||
"The purple rectangle should disappear animatedly"
|
||||
],
|
||||
"file": "animations/transition-animations-with-delay.json"
|
||||
},
|
||||
{
|
||||
"title": "Copy to clipboard",
|
||||
"case_id": 13,
|
||||
|
||||
Reference in New Issue
Block a user