OpenAI Loading Animation - Using Lottiefiles
In this Bubble tutorial we demonstrate how to improve your Bubble app's UX (user experience) by showing a loading animation while you wait for a response from the OpenAI API (ChatGPT). This tutorial uses a Lottie animation from Lottiefiles.
Unlock the power of loading animations: Learn how to enhance your Bubble app's UI with Lottie animations during API calls!
Elevate your user experience: Discover how to implement a sleek progress bar while your Bubble app fetches data from OpenAI.
Master the art of seamless API integration: Transform your Bubble app's loading process with custom animations and improved user feedback.
Adding a Loading Animation to Your Bubble App
In this Bubble tutorial video, I'm going to demonstrate how you can add in a loading animation while your Bubble app makes the API call to the OpenAI API. This is a great bit of UI and UX improvement that you can make to your app because sometimes users just get a bit confused when they click a button and it appears like nothing happens. Yes, Bubble puts a floating bar going across the top of the screen if you're doing a client-side workflow, but you can improve upon that so that your users know that they're getting something good and that they need to wait for it. This is all important when you're using OpenAI with Bubble.
Using Lottie Animations for Loading Indicators
I'm going to demonstrate in this tutorial how to do that with Lottie animations. Lottie files have become a popular format for animations on the web because they're lightweight. They're basically JSON files and they scale quite nicely too. So they've got a number of advantages over GIFs or other image animation files.
Adding the Lottie Plugin to Your Bubble App
To add in a Lottie animation, I need to add in a plugin. I'm just going to pick one of these. This one's got a lot of users, let's try that one and add in Lottie. Let's just make this 300 by 300. Obviously, you can adapt to the right size. For the Lottie file, if you want complete control over where you're hosting it, you can download the Lottie file and upload it to your Bubble storage. But in this example, I'm just going to pick one of these and link directly to it into one of my workspaces in Lottie.
Configuring the Lottie Animation
I think I need to click this one here of JSON. So then I paste that in there as the dynamic link and I'm going to preview my app to see if it loads in the Lottie animation correctly. Brilliant, yes it does.
Implementing the Loading Animation in Your Workflow
So how do I get it to show during my API call and hide the rest of the time? First of all, I've made sure that wherever I'm displaying my results, I have this unticked: "The element is visible on page load" and I tick "Collapse when hidden". Then on my Lottie element, now that I've added that in, I'm going to also say it is not visible on page load and it's collapsed when hidden.
Adding Workflow Steps for the Loading Animation
I need to add just a couple of steps or maybe three steps to my submit button. The first thing I'm going to do when the button's clicked is show my Lottie animation. I'm going to show that first. This is where the app makes a call to the OpenAI API, and so this is actually where the waiting occurs. Then, in this case, I'm using a custom state. I'm saving it as a custom state in order to display the results on my page. So I'm going to add in here "hide Lottie" because I know that it's completed the wait from OpenAI here, and then I'm going to show, in this case, I'm using a multi-line input. This just happens to be the element I'm using to display the reply from OpenAI.
Testing the Loading Animation
Let's preview and I'll go Twitter again and I'll say "What are the limitations of Bubble?" Okay, so I see my animation. I'm also getting the Bubble loading bar across the top, and then the animation gives way to the results.
Conclusion
So there you have it. That is how you can use a loading animation to improve the UI in your Bubble app. If you're learning Bubble, you need to check out our website Planet No Code where we've got hundreds of Bubble tutorial videos, some of which you cannot find on YouTube. We're just hoping to create the best resource for learning Bubble out there.
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Flexible Pricing Plans to Fit Your No-Code Journey
Choose the plan that aligns with your goals and start building your startup today.
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
Both plans offer full access to our learning resources, community, and support. The Annual plan provides a significant discount (over 15%) compared to paying monthly, and it allows you to lock in your rate for a full year.
Absolutely! You can easily upgrade or downgrade your membership plan at any time by logging into your account and selecting the desired plan. Any unused portion of your current plan will be prorated and applied to your new plan.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.
If you decide that Planet No Code isn't the right fit for you, you can cancel your membership at any time by logging into your account and navigating to the subscription management page. Click the "Cancel Membership" button, and your membership will be terminated at the end of your current billing cycle.