Jul 12, 2022·1 min read

Play Sound and Fire Confetti blocks in AppMaster

Learn how to create Play Sound and Fire Confetti in AppMaster.

Play Sound and Fire Confetti blocks in AppMaster

In AppMaster, you can add interactive elements to web applications such as visual effects, sounds, and more. In this article, we will show you how to use both Fire Confetti and Play Sound blocks in conjunction with each other.

The example described in this article is very simple so that a reader of any level of knowledge of working with the AppMaster platform can understand the essence of using these blocks and adapt them for their application.

Let's say our web application needs to respond somehow to the user login event. Namely, confetti shoots on the screen with a successful login, and a certain melody is played. It looks like this in the picture below (since this is an animation, there is no way to integrate sound since this is animation, but you can test the result yourself):

First of all, let's take a closer look at the Play Sound and Fire Confetti business process blocks themselves.

1. Play Sound - a block of a business process that plays sound from a file at a given link.

URL (mp3) [string] - path to the file. It is good practice to specify the path to the file from the application's file storage, then the URL will look like /api/_file//download/, where ID is the file ID in the application backend.

2. Fire Confetti - a business process block that fires confetti for the current user.

  • Preset [vmodel] - allows you to select the animation for shooting confetti

- Cannon

- Fireworks

- Realistic

- Snow

- School Pride

  • Duration (ms) [integer] - animation duration in ms

  • Position top (%) [integer] - deviation of the trigger point from the top of the screen

  • Position left (%) [integer] - deviation of the trigger point from the left of the screen

  • Particle count [integer] - number of confetti particles

  • Angle [integer] - angle

  • Colors [string array] - confetti particles colors

Let's move on to setting up the business process itself. In our example, confetti is fired after a successful user login. Thus, all necessary modifications will be made in the business process associated with the Login button.

It is necessary to find a moment in the business process that redirects the user to the next page upon successful login, namely the Navigate block. Our modification of the business process is as follows:

Fire Confetti block settings that is used here:

  • Preset = Cannon;

  • Duration (ms) = 1;

  • Particle Count = 500;

  • Angle = 30.

The input of the Play Sound block receives the path to the music file that was previously uploaded to the application server.

Thus, in this article we have described the possibilities of using Play Sound and Fire Confetti interactive blocks. After understanding how they work, you can use them yourself for more complex scenarios.

FAQ

How do I play a sound and show confetti after login?

Add both blocks to the business process that runs after a successful login. Place them before the Navigate block so the current user sees and hears the effect before the app opens the next page.

What file does the Play Sound block use?

Use Play Sound to play an MP3 file from a URL. For files stored in your AppMaster application, use the file storage download path with that file's ID.

Who sees the Fire Confetti animation?

The Fire Confetti block displays a confetti animation for the current user. It does not affect other users who are signed in to the app.

Which confetti presets can I choose?

Choose one of the available presets: Cannon, Fireworks, Realistic, Snow, or School Pride. Start with Cannon if you want a simple login celebration.

How do I control how long confetti lasts?

Set Duration in milliseconds. A value of 1 makes the burst very brief, while a larger value keeps the animation visible longer.

What does Particle count change?

Increase Particle count for a denser effect and lower it for a lighter one. The example uses 500 particles, which creates a noticeable burst.

How do I change where confetti appears?

Position top and Position left set the starting point as percentages of the screen. Adjust them to launch confetti from the center, a corner, or near a button.

Can I change the confetti direction and colors?

Use Angle to control the direction of the burst, then set Colors with an array of color values. These settings help the animation match your app's style.

Where should these blocks go in the login business process?

Put the effects after the login succeeds and before the app redirects the user. If you add them earlier, users may see the celebration even when login fails.

Can I use Play Sound and Fire Confetti outside login?

Yes. The same blocks can run after any successful user action, such as submitting a form, completing a payment, or finishing an onboarding step. Keep the effect brief so it supports the action without slowing the user down.

Easy to start
Create something amazing

Experiment with AppMaster with free plan.
When you will be ready you can choose the proper subscription.

Get Started