我正在构建一个Alexa技能,并使用APL进行可视化,我试图在一个容器中循环显示隐藏的图像,以复制一个动画GIF。
例如,我目前通过使用AnimateItem在给定的延迟后改变每个图像的可见性来实现第一个 "循环"。
{
"type": "APL",
"version": "1.3",
"settings": {},
"theme": "dark",
"import": [],
"resources": [],
"styles": {},
"onMount": [],
"graphics": {},
"commands": {
"fadeIn": {
"parameters": ["duration", "delay"],
"commands": [
{
"type": "AnimateItem",
"duration": "${duration}",
"delay": "${delay || 0}",
"value": [
{
"property": "opacity",
"from": 0,
"to": 1
}
]
}
]
},
"fadeOut": {
"parameters": ["duration", "delay"],
"commands": [
{
"type": "AnimateItem",
"duration": "${duration}",
"delay": "${delay || 0}",
"value": [
{
"property": "opacity",
"from": 1,
"to": 0
}
]
}
]
}
},
"layouts": {},
"mainTemplate": {
"parameters": ["payload"],
"items": [
{
"type": "Container",
"height": "100vh",
"width": "100vw",
"items": [
{
"type": "Image",
"width": "100vw",
"height": "100vh",
"source": "https://via.placeholder.com/100",
"position": "absolute",
"onMount": [
{
"type": "Sequential",
"commands": [
{
"type": "fadeOut",
"delay": 0,
"duration": 0
},
{
"type": "fadeIn",
"delay": 1,
"duration": 0
},
{
"type": "fadeOut",
"delay": 300,
"duration": 0
}
]
}
]
},
{
"type": "Image",
"width": "100vw",
"height": "100vh",
"source": "https://via.placeholder.com/200",
"position": "absolute",
"onMount": [
{
"type": "Sequential",
"commands": [
{
"type": "fadeOut",
"delay": 0,
"duration": 0
},
{
"type": "fadeIn",
"delay": 300,
"duration": 0
},
{
"type": "fadeOut",
"delay": 600,
"duration": 0
}
]
}
]
},
{
"type": "Image",
"width": "100vw",
"height": "100vh",
"source": "https://via.placeholder.com/300",
"position": "absolute",
"onMount": [
{
"type": "Sequential",
"commands": [
{
"type": "fadeOut",
"delay": 0,
"duration": 0
},
{
"type": "fadeIn",
"delay": 600,
"duration": 0
},
{
"type": "fadeOut",
"delay": 900,
"duration": 0
}
]
}
]
},
]
}
]
}
}
一旦迭代完成,重复这个过程的最佳方法是什么?我曾尝试在AnimateItem上使用Pagers和RepeatCount,但没有成功。
EDIT.更新了上面的代码,并提供了一个完整的APL文件的例子(交换了图像源,减少了3张而不是60多张图像,但逻辑是一样的);数据源文件是空的,所以没有提供数据源文件。
更新了上面的代码,增加了一个完整的APL文件的例子(交换了图像源,并将图像数量减少到3张,而不是60多张,但逻辑是一样的);数据源文件是空的,所以没有提供。
如果你能分享完整的apl文档和数据源,我可以帮助你,这样我就能知道你想实现什么。