Code Monkey home page Code Monkey logo

particle.forms's Introduction

Particles.Forms

A Xamarin.Forms library to display particles e.g. confetti. Should work on all platforms.

Get it from NuGet Nuget

Preview

API Reference

The starting point is the class ParticleView.

BindableProperty Default Description
IsActive true Whether or not the control is displaying particles. Use this property to stop and restart the particles.
IsRunning true Whether or not the control is animating particles. Use this property to pause and resume the particles.
HasFallingParticles false Whether or not falling particles should be shown.
FallingParticlesPerSecond 60 Amount of new particles to be added every second when HasFallingParticles is true.
AddParticlesOnTap false Whether or not to add particles on tap.
TapParticleCount 30 Amount of particles to add on tap when AddParticlesOnTap is true.
AddParticlesOnDrag false Whether or not to add particles on drag.
DragParticleCount 60 Amount of particles to add on drag when AddParticlesOnDrag is true.
DragParticleMoveType ParticleMovetype.Fall Particle movement type while dragging.
UseSKGLView False on all platforms except Android Whether or not to use the hardware-accelerated view for drawing.
ShowDebugInfo False Whether or not to show debug information.
DebugInfoColor LawnGreen Color to use when displaying debug information.

These properties aren't bindable.

Property Default Description
TouchParticleGenerator SimpleParticleGenerator A ParticleBase generator to be used when interacting with the ParticleView
FallingParticleGenerator FallingParticleGenerator A ParticleBase generator to be used when showing particles that fall from the top edge to the bottom
CanvasSize Contains the current canvas size

Usage Sample

<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:forms="clr-namespace:Particle.Forms;assembly=Particle.Forms"
             x:Class="Particle.Forms.Sample.Demo2.Demo2"
             Title="Custom Particles">
    <ContentPage.Resources>
        <x:Array Type="{x:Type Color}" x:Key="ConfettiColors">
            <Color>#a864fd</Color>
            <Color>#29cdff</Color>
            <Color>#78ff44</Color>
            <Color>#ff718d</Color>
            <Color>#fdff6a</Color>
            <Color>#ffcbf2</Color>
        </x:Array>
    </ContentPage.Resources>

    <Grid VerticalOptions="FillAndExpand"
          BackgroundColor="White"
          Margin="0 ,0, 0, 5">


        <forms:ParticleView x:Name="MyParticleCanvas"
                            IsActive="True"
                            IsRunning="True"
                            HasFallingParticles="True"
                            FallingParticlesPerSecond="20"
                            Margin="0, 20"
                            VerticalOptions="FillAndExpand"
                            HorizontalOptions="FillAndExpand"
                            ParticleColors="{StaticResource ConfettiColors}" />
    </Grid>
</ContentPage>

Tip

To conserver resources you can pause the particles when the Page is about to disappear and resume when the Page is about to appear.

        protected override void OnAppearing()
        {
            base.OnAppearing();

            MyParticleCanvas.IsRunning = true;
        }

        protected override void OnDisappearing()
        {
            base.OnDisappearing();

            MyParticleCanvas.IsRunning = false;
        }

particle.forms's People

Contributors

mariusmuntean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

particle.forms's Issues

Unable to find package NuGet.Build.Packaging with version (>= 0.2.5-dev.8) - Found 27 version(s) in nuget.org [ Nearest version: 0.2.2 ]

Could not build

I had trouble building and running the sample

Error Message

Severity Code Description Project File Line Suppression State
Error NU1102 Unable to find package NuGet.Build.Packaging with version (>= 0.2.5-dev.8)

  • Found 27 version(s) in nuget.org [ Nearest version: 0.2.2 ] Particle.Forms C:\repos\Particle.Forms\Src\Particle.Forms\Particle.Forms.csproj 1

Visual Studio Version

Microsoft Visual Studio Enterprise 2019
Version 16.8.4
VisualStudio.16.Release/16.8.4+30907.101
Microsoft .NET Framework
Version 4.8.04084
Xamarin 16.8.000.261 (d16-8@bb99248)

To Reproduce

Git Clone
Open Particle.Forms.Sample.sln
Set Android as Start Up Project
Build

Confetti doesn't render with a Carousel type control

Firstly - thanks for this. Nice bit of delight to be able to add to my app!

There is one hiccup though - it's not working with a Carousel type view: In my case, the syncfusion SfRotator control.
I've attached a sample, where the ParticleView is placed as the second item.

Sample.zip

Upgrade to Shapes and paths?

Thank You for this great project!

Any chance you would upgrade this to use the shapes and paths now available in Xamarin Forms?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.