Giter Site home page Giter Site logo

oiluis / pcflottiecomponent Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 4.0 11.98 MB

This is a PCF wrapper for the Lottie Animation Library. A Lottie is a JSON-based animation file format that enables designers to ship animations on any platform as easily as shipping static assets. ... Open-source and free Lottie players exist for the web, iOS, Android, Windows, QT, Tizen and other platforms.

License: MIT License

TypeScript 100.00%

pcflottiecomponent's Introduction

pcflottiecomponent

This is a PCF wrapper for the Lottie Animation Library. A Lottie is a JSON-based animation file format that enables designers to ship animations on any platform as easily as shipping static assets. ... Open-source and free Lottie players exist for the web, iOS, Android, Windows, QT, Tizen and now Power Apps :).

Watch and enjoy :)

Once you imported the solution on your environment, you just need to create a new Canvas App, import the Code Component and add the LottieComponent on your canvas. Make sure you have the Code Component feature enabled on your environment

In case you are new to Code Components (aka PCF) and you would like to know how to import and add a PCF on your canvas apps, just need to follow these steps.

Controling the animation

Basics

When you added the Lottie Component onto your canvas, it is good to change the default Component name first, since the default name makes it hard to access the component properties.
As currently there is no way to invoke a custom method from a PCF within the App, the way that the App controls the execution of the animation is through property update. So whenever you change some of the component properties explained below this process will start, pause or stop the animation.

Feel free to take a look at the Component Properties and play with them as you wish.

Starting an animation

After that, if you want to start the animation you can use the AutoPlay property and/or if you want to manually play the animation, you just need to declare and set a string variable that will be bounded with the StartAnimationToken property. Whenever you change the value of this property, the animation will start. See the example below:

Start Animation Token

The animation will only play if you change the value of the "Start Animation Token", that's the reason we are using the internal GUID() function from Power Apps, since it will calculate a new unique id every time the user clicks on the start button.

Stopping or Pausing an animation

In case you want stop or pause your animation you will follow these simple steps:

  1. Declare / Set a local variable which will hold the Start Animation Token value you want to pause or stop.
  2. IMPORTANT: Update the properties "Stop Animation Token" or "Pause Animation Token" (if you want to pause your animation) using the declared variable.

Start Animation Token

So on the example above, whenever the user hit the "Stop" button it will set the "StopAnimationToken" with the last value of the "StartAnimationToken" and as the "StopAnimationToken" variable is bounded with the Component.StopAnimationToken property, the animation will stop. This is the same principle in case you want to pause your animation, you will just need to use the "PauseAnimationToken" property.

Playing specific segments

In case you want to play specific segments (aka frames) of your animation, you can set or update the "StartAndEndFrame" property and then set the "StartAnimationToken" again, following the same process explained above.

Start Animation Token

Output properties

This component expose the following properties:

  • IsStopped: Indicates whether or not the animation reached the last frame
  • IsPaused: Indicates whether or not the animation is paused
  • CurrentFrame: The current frame number of the animation
  • TotalFrame: Determines the length (quantity of frames) that your animation has
  • StartAnimationToken: Useful if you want to Stop or Pause your animation

pcflottiecomponent's People

Contributors

oiluis avatar

Stargazers

 avatar  avatar Lukas Schauffele avatar Carlos F. Carvalho avatar  avatar Karin Fam avatar Colby avatar  avatar Mehmet Seçkin avatar Oleksandr Olashyn (dancingwithcrm) avatar Brendon Colburn avatar Renato Leite avatar

Watchers

 avatar  avatar  avatar

pcflottiecomponent's Issues

Import Fail

I cannot import your solution into my environment, it fails.
image

Unable to Import

I am having the same issue importing this PCF component as was raised in the previous Issue - i downloaded the file you linked to with the same error. Additionally, im unable to view the contents of the zip file, as if the file itself is corrupt.

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.