Ref: https://developer.amazon.com/ja/docs/alexa-presentation-language/apl-pager.html
- firstItem -> itmes -> lastItemの順番で表示される(多分)
- initialPage(0からはじまる)を使うことでスタート位置を調整可能。
- navigationを
forward-only
にすると、一方通行にできる
sample
{
"type": "APL",
"version": "1.0",
"theme": "dark",
"import": [
{
"name": "alexa-layouts",
"version": "1.0.0"
}
],
"resources": [],
"styles": {},
"layouts": {
"cover": {
"parameters": [{
"type": "string",
"name": "lead"
}],
"item": [
{
"type": "Container",
"width": "100vw",
"height": "100vh",
"alignItems": "center",
"justifyContent": "center",
"items": [
{
"type": "Text",
"text": "${lead}"
}
]
}
]
},
"myFirstLayout": {
"parameters": [
{
"name": "title",
"type": "string"
},{
"name": "subTitle",
"type": "string"
},{
"name": "imageUrl",
"type": "string"
},{
"name": "hint",
"type": "string"
}
],
"item": [
{
"type": "Container",
"direction": "row",
"alignItems": "center",
"justifyContent": "spaceBetween",
"height": "100vh",
"width": "100vw",
"items": [
{
"type": "Container",
"width": "50vw",
"alignItems": "center",
"justifyContent": "center",
"items": [
{
"type": "Text",
"text": "${title}",
"fontSize": "100dp"
}, {
"type": "Text",
"text": "${subTitle}"
}
]
}, {
"scale": "best-fill",
"width": "50vw",
"height": "100vh",
"type": "Image",
"source": "${imageUrl}"
}
]
}
]
}
},
"mainTemplate": {
"parameters": ["payload"],
"items": [
{
"type": "Pager",
"width": "100vw",
"height": "100vh",
"navigation": "forward-only",
"initialPage": 0,
"firstItem": [
{
"type": "cover",
"lead": "Welcome to the skill"
}
],
"lastItem": [
{
"type": "cover",
"lead": "See you !"
}
],
"items": [
{
"type": "myFirstLayout",
"title": "Hello",
"subTitle": "${payload.examplePayload.subTitle}",
"hint": "${payload.examplePayload.hint}",
"imageUrl": "${payload.examplePayload.imageUrl}"
},
{
"type": "myFirstLayout",
"title": "How are you?",
"subTitle": "${payload.examplePayload.subTitle}",
"hint": "${payload.examplePayload.hint}",
"imageUrl": "${payload.examplePayload.imageUrl}"
}
]
}
]
}
}
ネプリーグのトロッコアドベンチャーみたいなことも頑張ればできそう(適当)。