Skip to content

Instantly share code, notes, and snippets.

@willblaschko
Created March 23, 2019 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willblaschko/f8f86ccb4598c6bf4125f4ebde3a7b81 to your computer and use it in GitHub Desktop.
Save willblaschko/f8f86ccb4598c6bf4125f4ebde3a7b81 to your computer and use it in GitHub Desktop.
An example of how to create rough APL sprite animations using Pagers and sequential page commands. Your mileage may vary on smoothness of transition based on other commands being executed.
...
let spriteCommands = [];
for (...) {
...
spriteCommands.push({
"type": "SetPage",
"componentId": "b",
"position": "relative",
"value": spriteNumber,
"delay": frameTime
});
}
...
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.ExecuteCommands',
token: 'map',
commands: [{
"type": "Sequential",
"commands": spriteCommands
}]
});
...
{
"type": "Pager",
"id": "b",
"data": [...],
"width": "15vh",
"height": "100vh",
"scrollDirection": "vertical",
"items": [{
"type": "Container",
"height": "100vh",
"width": "100vw",
"bind": [{
"name": "parentIndex",
"value": "${index}"
}],
"items": [{
"type": "Image",
"backgroundColor": "#ff0000",
"source":"${data}",
"height": "15vh",
"width": "15vh"
}]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment