Reputation: 127
I'm trying to set up an animation on my image similar to pulse on https://daneden.github.io/animate.css/
So, in Xamarin.Forms, i'm trying to recreate that animation using ScaleTo from class ViewExtensions:
await image.ScaleTo (1.3, 500);
await image.ScaleTo (1, 500);
await image.ScaleTo (1.3, 500);
await image.ScaleTo (1, 500);
But actually nothing appens, my image remains the same.
How can i resolve this?
Thanks for your help.
Upvotes: 1
Views: 157
Reputation: 74134
I would convert that CSS pulse to a custom Parent/Child animation.
//animation-duration: 1s;
@keyframes pulse {
from {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50% {
-webkit-transform: scale3d(1.05, 1.05, 1.05);
transform: scale3d(1.05, 1.05, 1.05);
}
to {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
new Animation
{
{ 0, 0.5, new Animation (v => image.Scale = v, 1, 1.05) },
{ 0.5, 1, new Animation (v => image.Scale = v, 1.05, 1) },
}.Commit(this, "viewAnim", 16, 1000, Easing.Linear);
Upvotes: 1