mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
5673b34bca
change 1/0 to true/false into test_data
207 lines
5.3 KiB
JSON
207 lines
5.3 KiB
JSON
{
|
|
"templates": {
|
|
"title": {
|
|
"type": "text",
|
|
"font_size": 20,
|
|
"line_height": 24,
|
|
"font_weight": "bold",
|
|
"paddings": {
|
|
"left": 24,
|
|
"right": 24,
|
|
"bottom": 16
|
|
}
|
|
},
|
|
"subtitle": {
|
|
"font_size": 15,
|
|
"line_height": 20,
|
|
"type": "text",
|
|
"paddings": {
|
|
"left": 24,
|
|
"right": 24
|
|
}
|
|
},
|
|
"image_block": {
|
|
"type": "image",
|
|
"image_url": "https://yastatic.net/s3/home/yandex-app/div_demo/containers.png",
|
|
"width": {
|
|
"type": "fixed",
|
|
"value": 150
|
|
},
|
|
"height": {
|
|
"type": "fixed",
|
|
"value": 150
|
|
},
|
|
"margins": {
|
|
"left": 16,
|
|
"right": 16,
|
|
"bottom": 16
|
|
}
|
|
},
|
|
"button": {
|
|
"type": "text",
|
|
"width": {
|
|
"type": "match_parent"
|
|
},
|
|
"height": {
|
|
"type": "wrap_content"
|
|
},
|
|
"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"
|
|
}
|
|
},
|
|
"card": {
|
|
"log_id": "sample_card",
|
|
"variables": [
|
|
{
|
|
"name": "change_state",
|
|
"type": "boolean",
|
|
"value": false
|
|
},
|
|
{
|
|
"name": "state",
|
|
"type": "boolean",
|
|
"value": false
|
|
}
|
|
],
|
|
"variable_triggers": [
|
|
{
|
|
"condition": "@{change_state && state}",
|
|
"mode": "on_variable",
|
|
"actions": [
|
|
{
|
|
"log_id": "update change_state flag",
|
|
"url": "div-action://set_variable?name=change_state&value=false"
|
|
},
|
|
{
|
|
"log_id": "update change_state flag",
|
|
"url": "div-action://set_variable?name=state&value=false"
|
|
},
|
|
{
|
|
"log_id": "change state",
|
|
"url": "div-action://set_state?state_id=0/transition_change_demo_state/state1"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"condition": "@{change_state && !state}",
|
|
"mode": "on_variable",
|
|
"actions": [
|
|
{
|
|
"log_id": "update change_state flag",
|
|
"url": "div-action://set_variable?name=change_state&value=false"
|
|
},
|
|
{
|
|
"log_id": "update state variable",
|
|
"url": "div-action://set_variable?name=state&value=true"
|
|
},
|
|
{
|
|
"log_id": "change state",
|
|
"url": "div-action://set_state?state_id=0/transition_change_demo_state/state2"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"states": [
|
|
{
|
|
"state_id": 0,
|
|
"div": {
|
|
"type": "container",
|
|
"orientation": "vertical",
|
|
"margins": {
|
|
"top": 24,
|
|
"bottom": 24
|
|
},
|
|
"items": [
|
|
{
|
|
"type": "title",
|
|
"text": "Move and resize animations"
|
|
},
|
|
{
|
|
"type": "subtitle",
|
|
"text": "For each div, you can customize the transition animation to be played when the div changes its size or position.\n\nIn the example, the picture is animated to increase in width and moves to the upper-right corner when switching to state 2.",
|
|
"margins": {
|
|
"bottom": 24
|
|
}
|
|
},
|
|
{
|
|
"type": "state",
|
|
"width": {
|
|
"type": "match_parent"
|
|
},
|
|
"height": {
|
|
"type": "fixed",
|
|
"value": 250
|
|
},
|
|
"div_id": "transition_change_demo_state",
|
|
"states": [
|
|
{
|
|
"state_id": "state1",
|
|
"div": {
|
|
"type": "image_block",
|
|
"id": "image",
|
|
"alignment_horizontal": "center",
|
|
"alignment_vertical": "top",
|
|
"width": {
|
|
"type": "match_parent"
|
|
},
|
|
"transition_change": {
|
|
"type": "change_bounds",
|
|
"duration": 1000
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"state_id": "state2",
|
|
"div": {
|
|
"type": "image_block",
|
|
"id": "image",
|
|
"alignment_horizontal": "right",
|
|
"alignment_vertical": "bottom",
|
|
"transition_change": {
|
|
"type": "change_bounds",
|
|
"duration": 1000
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"type": "button",
|
|
"alignment_horizontal": "center",
|
|
"text": "Test Button",
|
|
"actions": [
|
|
{
|
|
"log_id": "set_state1",
|
|
"url": "div-action://set_variable?name=change_state&value=true"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|