Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xeladotbe/220611fe994a2dee85cc5e9662aabe24 to your computer and use it in GitHub Desktop.
Save xeladotbe/220611fe994a2dee85cc5e9662aabe24 to your computer and use it in GitHub Desktop.
{
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>Watch as I move this plane based on your position!</speak>"
},
"directives": [
{
"type": "Alexa.Presentation.APL.RenderDocument",
"document": {
"type": "APL",
"version": "1.4",
"extensions": [
{
"name": "SmartMotion",
"uri": "alexaext:smartmotion:10"
},
{
"name": "EntitySensing",
"uri": "alexaext:entitysensing:10"
}
],
"settings": {
"SmartMotion": {
"deviceStateName": "DeviceState",
"wakeWordResponse": "turnToWakeWord"
},
"EntitySensing": {
"primaryUserName": "PrimaryUser"
}
},
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"width": "100vw",
"height": "100vh",
"items": [
{
"type": "Container",
"position": "absolute",
"top": 0,
"left": 0,
"width": "300vw",
"height": "100vh",
"bind": [
{
"name": "InitialTranslateX",
"value": -1080
},
{
"name": "CurrentTranslateX",
"value": "${InitialTranslateX}"
},
{
"name": "PrimaryUserRelativeAngle",
"value": 0
},
{
"name": "TargetTranslateX",
"value": 0
}
],
"items": [
{
"type": "Image",
"source": "https://aruntalkstech.s3.amazonaws.com/EchoShow10Demo/plane.jpg",
"width": "100%",
"height": "100%",
"scale": "none",
"align": "left",
"transform": [
{
"translateX": "${CurrentTranslateX}"
}
],
"handleTick": [
{
"when": "${environment.extension.EntitySensing}",
"minimumDelay": 100,
"commands": [
{
"type": "SetValue",
"property": "PrimaryUserRelativeAngle",
"value": "${Math.floor(PrimaryUser.poise.relativeAngle)}"
},
{
"type": "SetValue",
"property": "TargetTranslateX",
"value": "${InitialTranslateX + (PrimaryUserRelativeAngle * 10)}"
}
]
},
{
"when": "${environment.extension.EntitySensing}",
"minimumDelay": 20,
"commands": [
{
"when": "${TargetTranslateX > CurrentTranslateX}",
"type": "SetValue",
"property": "CurrentTranslateX",
"value": "${CurrentTranslateX + 10}"
},
{
"when": "${TargetTranslateX < CurrentTranslateX}",
"type": "SetValue",
"property": "CurrentTranslateX",
"value": "${CurrentTranslateX - 10}"
}
]
}
]
}
]
},
{
"type": "Container",
"width": "100%",
"height": "100%",
"alignItems": "center",
"justifyContent": "center",
"items": [
{
"type": "Image",
"position": "absolute",
"top": "32dp",
"right": "32dp",
"scale": "best-fit",
"width": 450,
"height": 100,
"source": "https://aruntalkstech.s3.amazonaws.com/EchoShow10Demo/plane.jpg"
},
{
"type": "Text",
"text": "center",
"fontSize": "100dp",
"fontWeight": 700
}
]
}
]
}
]
}
},
"datasources": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment