Created
October 15, 2020 20:58
-
-
Save arunjeetsingh/9cfcdf40b7120d97036062412ced6863 to your computer and use it in GitHub Desktop.
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
{ | |
"outputSpeech": { | |
"type": "SSML", | |
"ssml": "<speak>Watch as I move this plane using the device position!</speak>" | |
}, | |
"directives": [ | |
{ | |
"type": "Alexa.Presentation.APL.RenderDocument", | |
"document": { | |
"type": "APL", | |
"version": "1.4", | |
"extensions": [ | |
{ | |
"name": "SmartMotion", | |
"uri": "alexaext:smartmotion:10" | |
} | |
], | |
"settings": { | |
"SmartMotion": { | |
"deviceStateName": "DeviceState", | |
"wakeWordResponse": "followOnWakeWord" | |
} | |
}, | |
"mainTemplate": { | |
"parameters": [ | |
"payload" | |
], | |
"items": [ | |
{ | |
"type": "Container", | |
"width": "300vw", | |
"height": "100vh", | |
"bind": [ | |
{ | |
"name": "InitialTranslateX", | |
"value": -1280 | |
}, | |
{ | |
"name": "CurrentTranslateX", | |
"value": "${InitialTranslateX}" | |
}, | |
{ | |
"name": "DeviceStateAbsoluteAngle", | |
"value": 0 | |
}, | |
{ | |
"name": "TargetTranslateX", | |
"value": 0 | |
} | |
], | |
"items": [ | |
{ | |
"type": "Image", | |
"source": "https://aruntalkstech.s3.amazonaws.com/EchoShow10Demo/plane.jpg", | |
"width": "100%", | |
"height": "100%", | |
"scale": "none", | |
"transform": [ | |
{ | |
"translateX": "${CurrentTranslateX}" | |
} | |
], | |
"handleTick": [ | |
{ | |
"when": "${environment.extension.SmartMotion}", | |
"minimumDelay": 100, | |
"commands": [ | |
{ | |
"type": "SetValue", | |
"property": "DeviceStateAbsoluteAngle", | |
"value": "${Math.floor(DeviceState.poise.absoluteAngle)}" | |
}, | |
{ | |
"type": "SetValue", | |
"property": "TargetTranslateX", | |
"value": "${InitialTranslateX + (DeviceStateAbsoluteAngle * 10)}" | |
} | |
] | |
}, | |
{ | |
"when": "${environment.extension.SmartMotion}", | |
"minimumDelay": 20, | |
"commands": [ | |
{ | |
"when": "${TargetTranslateX > CurrentTranslateX}", | |
"type": "SetValue", | |
"property": "CurrentTranslateX", | |
"value": "${CurrentTranslateX + 10}" | |
}, | |
{ | |
"when": "${TargetTranslateX < CurrentTranslateX}", | |
"type": "SetValue", | |
"property": "CurrentTranslateX", | |
"value": "${CurrentTranslateX - 10}" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
}, | |
"datasources": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment