Skip to content

Commit 51af16e

Browse files
authored
New snippet (gallery-with-animated-cards) (#109)
2 parents 49e60ca + adddd34 commit 51af16e

File tree

6 files changed

+103
-0
lines changed

6 files changed

+103
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Gallery with animated cards
2+
3+
A fairly simple use of a dynamic SVG image in a gallery to highlight the selected item with an animation.
4+
5+
![Gallery with animated cards](./assets/gallery-with-animated-cards.gif)
6+
7+
## Authors
8+
9+
Snippet|Author
10+
--------|---------
11+
David Zoonekyndt | [GitHub](https://github.com/DavidZoon) ([LinkedIn](https://www.linkedin.com/in/david-zoonekyndt/) )
12+
13+
## Minimal path to awesome
14+
15+
1. Open your canvas app in **Power Apps**
16+
1. Copy the contents of the **[YAML-file](./source/gallery-with-animated-cards.yaml)**
17+
1. Click on the three dots of the screen where you want to add the snippet and select "Paste"
18+
1. Customize the appearance and behavior of the map by changing the parameters in the With() of the Image object:
19+
![Customize With()](./assets/gallery-with-animated-cards-customize.png)
20+
21+
### ⚠️⚠️⚠️ Important
22+
23+
Be careful, however, the visuals are less attractive on a gallery template that is too stretched in height or width.
24+
The card is responsive; it will adapt to the gallery template format. The colors also change with the modern theme of your application.
25+
26+
<img width="800" alt="phone_portrait.png" src="./assets/gallery-with-animated-cards-theme-change.gif" />
27+
28+
## Code
29+
30+
**[YAML-file](./source/gallery-with-animated-ards.yaml)**
31+
32+
## Disclaimer
33+
34+
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
35+
36+
<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-snippets/power-apps/gallery-with-animated-ards" aria-hidden="true" />
115 KB
Loading
438 KB
Loading
268 KB
Loading
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[
2+
{
3+
"$schema": "https://developer.microsoft.com/en-us/json-schemas/pnp/samples/v1.0/metadata-schema.json",
4+
"name": "pnp-powerplatform-snippets-gallery-with-animated-cards",
5+
"version": "1.0.0.0",
6+
"source": "pnp",
7+
"creationDateTime": "2025-07-13T00:00:00.000Z",
8+
"updateDateTime": "2025-07-13T00:00:00.000Z",
9+
"title": "Form Factor selector",
10+
"shortDescription": "A fairly simple use of a dynamic SVG image in a gallery to highlight the selected item with an animation.",
11+
"longDescription": [
12+
"Be careful, however, the visuals are less attractive on a gallery template that is too stretched in height or width. The card is responsive; it will adapt to the gallery template format. The colors also change with the modern theme of your application."
13+
],
14+
"url": "https://github.com/DavidZoon/powerplatform-snippets/blob/main/power-apps/gallery-with-animated-cards/",
15+
"products": [
16+
"Power Platform",
17+
"Power Apps",
18+
"powerplatform-snippets",
19+
"power-apps-snippets"
20+
],
21+
"tags": [],
22+
"categories": [],
23+
"metadata": [
24+
{
25+
"key": "Product",
26+
"value": "Power Apps"
27+
},
28+
{
29+
"key": "Type",
30+
"value": "Snippet"
31+
}
32+
],
33+
"thumbnails": [
34+
{
35+
"type": "image",
36+
"order": 100,
37+
"url": "https://github.com/DavidZoon/powerplatform-snippets/blob/cd24bdfbc69c69f48183bc70258e648d2fa0cf5b/power-apps/gallery-with-animated-cards/assets/gallery-with-animated-cards.gif",
38+
"alt": "Preview GIF"
39+
}
40+
],
41+
"authors": [
42+
{
43+
"gitHubAccount": "DavidZoon",
44+
"name": "David Zoonekyndt",
45+
"pictureUrl": "https://github.com/DavidZoon.png"
46+
}
47+
]
48+
}
49+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- GalleryWithAnimatedCards:
2+
Control: Gallery@2.15.0
3+
Variant: Vertical
4+
Properties:
5+
Height: =689
6+
TemplateSize: =300
7+
Width: =498
8+
WrapCount: =2
9+
X: =40
10+
Y: =40
11+
Children:
12+
- ImageCard:
13+
Control: Image@2.2.3
14+
Properties:
15+
Height: =Parent.TemplateHeight
16+
Image: "=With({\r\n _Text:If(ThisItem.IsSelected,\"Selected\",\"Not Selected\"),\r\n _Height:Text(Self.Height,\"0.0\",\"en-US\"),\r\n _Width:Text(Self.Width,\"0.0\",\"en-US\"),\r\n _BackGroundColor:If(ThisItem.IsSelected,Mid(JSON(App.Theme.Colors.Darker60),2,7),Mid(JSON(App.Theme.Colors.Lighter40),2,7)),\r\n _GradientColors:{Color1:\"rgb(0, 183, 255)\",Color2:\"rgb(255, 48, 255)\"}\r\n \r\n},\"data:image/svg+xml;utf8, \" & EncodeUrl($\"<svg viewBox='0 0 {_Width} {_Height}' xmlns='http://www.w3.org/2000/svg'>\r\n<defs>\r\n<linearGradient id='gradient-border' x1='0%' y1='0%' x2='100%' y2='0%'> <stop offset='0%' stop-color='{_GradientColors.Color1}' /> <stop offset='100%' stop-color='{_GradientColors.Color2}' /></linearGradient>\r\n<clipPath id='cut-bottom'> <rect id='Rectangle' x='3%' y='3%' width='94%' height='94%' rx='15' /> </clipPath>\r\n</defs>\r\n\r\n<use id='Bakcground' href='#Rectangle' fill='{_BackGroundColor}' />\r\n{If(ThisItem.IsSelected,\"<g clip-path='url(#cut-bottom)'>\r\n<rect id='TurningColors' x='-50%' y='30%' width='200%' height='40%' fill='url(#gradient-border)' transform-origin='center'> <animateTransform attributeName='transform' type='rotate' from='0 0 0' to='360 0 0' dur='3s' repeatCount='indefinite' /> </rect></g>\")}\r\n<use id='Foreground' href='#Rectangle' fill='{_BackGroundColor}' transform-origin='center' transform='scale(.95 .95)' /> <text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' fill='white' font-size='32' font-family='sans-serif' font-weight='bold'> {_Text} </text> </svg>\")\r\n)"
17+
OnSelect: =Select(Parent)
18+
Width: =Parent.TemplateWidth

0 commit comments

Comments
 (0)