Introducing the Effects View Control for Xamarin.Forms | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (173).NET Core  (29).NET MAUI  (203)Angular  (107)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (211)BoldSign  (13)DocIO  (24)Essential JS 2  (106)Essential Studio  (200)File Formats  (65)Flutter  (132)JavaScript  (219)Microsoft  (118)PDF  (81)Python  (1)React  (98)Streamlit  (1)Succinctly series  (131)Syncfusion  (897)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (50)Windows Forms  (61)WinUI  (68)WPF  (157)Xamarin  (161)XlsIO  (35)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (146)Chart  (127)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (618)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (39)Extensions  (22)File Manager  (6)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (501)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (42)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (381)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (17)Web  (582)What's new  (323)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Introducing the Effects View Control for Xamarin.Forms

Introducing the Effects View Control for Xamarin.Forms

A modern-day mobile application can no longer be imagined without attractive animations. Mobile applications commonly include many animation types, like ripple, rotation, and scaling. These kinds of animations make the application highly interactive.

The options available in Xamarin.Forms to achieve these kinds of effects for iOS and Android are quite few. In Xamarin.Android, you can use RippleDrawable to add the ripple effect, but it is not available for Xamarin.iOS. Moreover, this effect works better when used as a separate feature. When you need to include multiple animations simultaneously, like ripple and rotation, you need quite a lot of tweaking in shared and platform-specific projects.

To provide these effects in a more efficient way, we are introducing a new component called Effects View in Xamarin.Forms for the iOS and Android platforms in our 2019 Volume 3 beta release. This control is available as a part of Syncfusion.Xamarin.Core NuGet package. It is a container control that can accept any type of view as its child. It provides effects like highlighting the background, ripple, selection, scale-up, scale down, and rotation. One good thing about this control is that these effects also work just fine in different combinations like highlight and ripple, ripple and selection, selection and scale, ripple and rotation, and so on.

Different effects

There are different types of effects available in Effects View. I will explain how to use them separately and then some possible combinations of them.

Highlight

The highlight effect can be achieved by setting the effect mode to Highlight. This effect will fade out automatically after completion.

<ContentPage xmlns:effectsView="clr-namespace:Syncfusion.XForms.EffectsView;assembly=Syncfusion.Core.XForms">
   
  <effectsView:SfEffectsView TouchDownEffects="Highlight">                 
     <Grid>....</Grid>
  </effectsView:SfEffectsView>
 
</ContentPage>
highlight effect in Xamarin Forms Effects view
Highlight effect

Ripple

The ripple effect can be achieved by setting the effect mode to Ripple. Like the highlight effect, this effect, too, will fade out automatically after completion.

<effectsView:SfEffectsView TouchDownEffects="Ripple">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>
Ripple effect in Xamarin Forms Effects View
Ripple effect

Rotation

The rotation effect can be achieved by setting the effect mode to Rotation. The content of the Effects View will be rotated based on the value of Angle.

<effectsView:SfEffectsView TouchDownEffects="Rotation" Angle="180">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>
Rotation effect in Xamarin Forms Effects View
Rotation effect

Scaling

The scaling effect can be achieved by setting the effect mode to Scale. The content of the Effects View will scale down or scale-up based on the value of ScaleFactor, i.e. if it is less than 1, there will be a scale-down effect and if it is greater than 1, there will be a scale-up effect.

<effectsView:SfEffectsView TouchDownEffects="Scale" ScaleFactor="0.8">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>
Scale effect in Xamarin Forms Effects View
Scale effect

Selection

You can move to the selection state by setting the effect mode to Selection.

<effectsView:SfEffectsView TouchDownEffects="Selection">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>

You can also set the property IsSelected to true.

<effectsView:SfEffectsView IsSelected="true">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>
Selection effect in Xamarin Forms Effects View
Selection effect

In both approaches, the SelectionChanged event will be triggered, which can be used for application-level customizations.

Scale and selection

As I mentioned in the introduction of this blog, apart from using these effects separately, you can also use them combined. Here are some examples.

Let’s set scale and selection for the effects mode.

<effectsView:SfEffectsView TouchDownEffects="Scale, Selection" ScaleFactor="0.8">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>

Scale and selection effect in Xamarin Forms Effects View
Scale and selection effect

Ripple and scale

Another possible combination is ripple and scale. Let’s see how they behave.

<effectsView:SfEffectsView TouchDownEffects="Ripple, Scale">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>
Ripple and scale effect in Xamarin Forms Effects View
Ripple and scale effect

Ripple and rotation

You can also use a ripple and rotation combination.

<effectsView:SfEffectsView TouchDownEffects="Ripple, Rotation">                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>
Ripple and rotation effect in Xamarin Forms Effects View
Ripple and rotation effect

Touch interactions

In the previous code snippets, you may have noticed that I set the different effects to the property TouchDownEffects. As the name implies, these effects will render during touch-down interaction with the Effects View control. If you need these effects during long-press or touch-up interactions, you can use the LongPressEffects and TouchUpEffects properties.

Another interesting aspect is that you can have different effects for different interactions. E.g., you can set Highlight for touch down and Ripple for long press.

<effectsView:SfEffectsView TouchDownEffects="Highlight" LongPressEffects="Ripple, Selection" >                 
    <Grid>....</Grid>
</effectsView:SfEffectsView>

Trigger effects through API

In addition to touch interactions, you can also trigger all these effects using the method ApplyEffects. All the parameters of this method are optional and can be used as necessary. If no parameter is passed, the ripple effect will be triggered. It accepts the following optional parameters:

‘effects’—Sets the type(s) of effect.

‘rippleStartPosition’—During interactions, the ripple effect will always start from the point of interaction. While using the ApplyEffects method, you can start the ripple from the left, right, top, or bottom position. Default is center.

‘rippleStartPoint’—Sets the exact x, y point from which the ripple should start.

‘repeat’—Sets the value for whether or not to repeat the ripple effect continuously.

Repeat and fade out the ripple

Ripple with fade out is one of the most common animations we see in mobile applications.You can achieve this effect by passing repeat in the ApplyEffects method and setting the FadeOutRipple property to true.

this.RotationEffectsView.ApplyEffects(repeat: true);

If you need to stop the ripple effect, you can use Reset() method.

this.RotationEffectsView.Reset();
Ripple with fade out effect in Xamarin Forms Effects View
Ripple with fade out effect

Conclusion

In this blog post, we walked through our new Xamarin.Forms Effects View component and its usages in various scenarios. To learn more about the Effects View component, refer to our UG documentation.  You can drop your comments in the section below if you need any clarification about this component.

We are likely to add more effects to this component in future releases. If you need support for specific effects in this component or have any questions, contact us through our support forum, Direct-Trac, or feedback portal. We are waiting to hear your feedback about this new component!

Tags:

Share this post:

Comments (5)

Any plans for UWP support?

Mohamed Samsudeen
Mohamed Samsudeen

Hi Philippe,

Yes. We have plans to provide UWP support in our future releases.

Regards,
Samsudeen

really useful

can we use in normal them without using sync fusion them?

Hi Ashish,

If you are asking, whether it is possible to apply these effects to Xamarin.Forms framework controls like Image, Grid, etc – Yes. You can.

https://help.syncfusion.com/xamarin/effects-view/getting-started#initializing-sfeffectsview

Please let us know if further information is needed.

Regards,
Samsudeen

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed