Created
March 23, 2019 22:20
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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 | |
}] | |
}); | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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