Skip to content

Instantly share code, notes, and snippets.

@mlopezr
Last active August 27, 2019 09:32
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 mlopezr/eb98dc7a4e380a69e60c717b780ced4e to your computer and use it in GitHub Desktop.
Save mlopezr/eb98dc7a4e380a69e60c717b780ced4e to your computer and use it in GitHub Desktop.
Responsive APL Splash Screen with logo and hint
{
"document": {
"type": "APL",
"version": "1.0",
"theme": "dark",
"import": [],
"resources": [],
"styles": {},
"layouts": {
"ResponsiveSplashLayout": {
"parameters": [
"backgroundImage",
"logoImage",
"titleText",
"hintText"
],
"items": [
{
"type": "Container",
"height": "100vh",
"width": "100vw",
"alignItems": "center",
"justifyContent": "center",
"items": [
{
"description": "Background image with 20% opacity",
"type": "Image",
"source": "${backgroundImage}",
"overlayColor": "rgba(0, 0, 0, 0.2)",
"height": "100vh",
"width": "100vw",
"position": "absolute",
"scale": "best-fill"
},
{
"description": "White frame with 95% opacity. Width is 70% except for round screens (left and right borders are outside of the viewport)",
"type": "Frame",
"backgroundColor": "rgba(255,255,255, 0.95)",
"width": "${viewport.shape != 'round' ? '70vw' : '150vw'}",
"height": "65vh",
"borderRadius": "2vh",
"paddingTop": "2vh",
"paddingBottom": "2vh",
"paddingLeft": "2vh",
"paddingRight": "2vh",
"items": [
{
"description": "Colored border frame",
"type": "Frame",
"height": "100%",
"width": "100%",
"borderRadius": "2vh",
"borderColor": "black",
"borderWidth": "2px",
"items": [
{
"type": "Container",
"width": "100%",
"alignItems": "center",
"paddingTop": "5vh",
"items": [
{
"description": "Title, hidden on round screens",
"when": "${viewport.shape != 'round'}",
"type": "Text",
"text": "${titleText}",
"textAlign": "center",
"fontFamily": "Arial",
"color": "black",
"fontSize": "9vh",
"paddingBottom": "2vh"
},
{
"description": "Logo",
"type": "Image",
"source": "${logoImage}",
"width": "25vw",
"height": "25vh"
},
{
"description": "Hint, width set to frame width for large screens, 80% for round screens",
"type": "Text",
"text": "<i>${hintText}</i>",
"textAlign": "center",
"fontFamily": "Bookerly",
"color": "black",
"fontSize": "7vh",
"width": "${viewport.shape != 'round' ? '65vw' : '80vw'}",
"paddingTop": "4vh"
}
]
}
]
}
]
}
]
}
]
}
},
"mainTemplate": {
"parameters": [
"dataSources"
],
"items": [
{
"type": "ResponsiveSplashLayout",
"backgroundImage": "${dataSources.splash.properties.backgroundImage}",
"logoImage": "${dataSources.splash.properties.logoImage}",
"titleText": "${dataSources.splash.properties.titleText}",
"hintText": "${dataSources.splash.properties.hintText}"
}
]
}
},
"dataSources": {
"splash": {
"type": "Object",
"properties": {
"backgroundImage": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Sunrise_at_Columbia_River_in_Washington_1.jpg/800px-Sunrise_at_Columbia_River_in_Washington_1.jpg",
"logoImage": "https://via.placeholder.com/300?text=Skill%20Logo",
"titleText": "Welcome to this Skill",
"hintText": "Try \"give me the last update\""
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment