Explore all Animation open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Animation

animate.css

v4.1.1

manim

ManimGL 1.6.1

anime

v3.2.1

lottie-android

5.0.3

react-spring

v9.4.5-beta.1

Popular Libraries in Animation

animate.css

by animate-css doticoncssdoticon

star image 74293 doticonNOASSERTION

🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.

LeetCodeAnimation

by MisterBooo doticonjavadoticon

star image 66783 doticon

Demonstrate all the questions on LeetCode in the form of animation.(用动画的形式呈现解LeetCode题目的思路)

manim

by 3b1b doticonpythondoticon

star image 43754 doticonMIT

Animation engine for explanatory math videos

anime

by juliangarnier doticonjavascriptdoticon

star image 40224 doticonMIT

JavaScript animation engine

lottie-android

by airbnb doticonjavadoticon

star image 32616 doticonApache-2.0

Render After Effects animations natively on Android and iOS, Web, and React Native

react-spring

by pmndrs doticontypescriptdoticon

star image 22856 doticonMIT

✌️ A spring physics based React animation library

lottie-ios

by airbnb doticonswiftdoticon

star image 22558 doticonApache-2.0

An iOS library to natively render After Effects vector animations

Hero

by HeroTransitions doticonswiftdoticon

star image 20722 doticonMIT

Elegant transition library for iOS & tvOS

react-motion

by chenglou doticonjavascriptdoticon

star image 20656 doticonMIT

A spring that solves your animation problems.

Trending New libraries in Animation

manim

by ManimCommunity doticonpythondoticon

star image 9720 doticonMIT

A community-maintained Python framework for creating mathematical animations.

pose-animator

by yemount doticonjavascriptdoticon

star image 8018 doticonApache-2.0

rough-notation

by rough-stuff doticontypescriptdoticon

star image 5517 doticonMIT

Create and animate hand-drawn annotations on a web page

html-css

by gustavoguanabara doticonhtmldoticon

star image 4011 doticonMIT

Curso de HTML5 e CSS3

boring-avatars

by boringdesigners doticonjavascriptdoticon

star image 3457 doticonMIT

Boring avatars is a tiny JavaScript React library that generates custom, SVG-based avatars from any username and color palette.

ani-cli

by pystardust doticonshelldoticon

star image 3401 doticonGPL-3.0

A cli tool to browse and play anime

svg-path-editor

by Yqnn doticontypescriptdoticon

star image 2496 doticonApache-2.0

Online editor to create and manipulate SVG paths

moti

by nandorojo doticontypescriptdoticon

star image 2322 doticon

🐼 The React Native (+ Web) animation library, powered by Reanimated 2.

AnimeXStream

by mukul500 doticonkotlindoticon

star image 1869 doticonMIT

An Android app to watch anime on your phone without ads.

Top Authors in Animation

1

codrops

103 Libraries

star icon28528

2

mattdesl

27 Libraries

star icon3226

3

londonappbrewery

25 Libraries

star icon59

4

CodyHouse

23 Libraries

star icon1500

5

alikinvv

19 Libraries

star icon445

6

hughsk

18 Libraries

star icon233

7

mrmrs

17 Libraries

star icon163

8

substack

17 Libraries

star icon403

9

svgdotjs

17 Libraries

star icon10211

10

tutsplus

15 Libraries

star icon100

1

103 Libraries

star icon28528

2

27 Libraries

star icon3226

3

25 Libraries

star icon59

4

23 Libraries

star icon1500

5

19 Libraries

star icon445

6

18 Libraries

star icon233

7

17 Libraries

star icon163

8

17 Libraries

star icon403

9

17 Libraries

star icon10211

10

15 Libraries

star icon100

Trending Kits in Animation

We can create any animation with suitable libraries or combinations of libraries that are well-known for their functionalities using Python Animation Libraries. For developers looking for options with less complex code with maximum customization options, users can customize their plots and designs depending on their preferences.  


Choosing a suitable library plays a key role in any machine learning or data science project, and we should do it properly to avoid other related issues which may arise. Some libraries offer an interactive plot to attract playing with the graph and visualize it uniquely. It will allow you to edit videos, create animations, and create a map or geological animations where we can analyze the geological data. 


Here is the list of handpicked 18 best Python Animation Libraries in 2023 which will help you with your animation requirements: 

manim - 3b1b

  • Is a Python library for creating mathematical animations and educational videos that Grant Sanderson develops.  
  • Is an open source library that allows users to create high-quality animations which visualize mathematical concepts like animations of graphs, functions, fractals, and more.   
  • Uses Python code for creating animations which we can export to animated GIFs or video files. 

PythonRobotics

  • Is a Python library for implementing different robotics simulations, visualizations, and algorithms. 
  • Offers various resources and tools for robotics developers, like algorithms for path planning, localization, motion control, mapping, and many more.   
  • Includes simulation environments like 2D and 3D simulators, that will allow developers to test their algorithms in virtual environments before deploying them on real robots.   

matplotlib

  • Is a comprehensive library for creating animated, interactive visualizations and static in Python. 
  • Produces publication-quality figures in different interactive environments and hardcopy formats across platforms. 
  • Can be used in Python Scripts, web application servers, various graphical user interface toolkits, and Python/IPython shells. 

manim - ManimCommunity

  • Is an animation engine for explanatory math videos used for programmatically creating precise animations. 
  • Includes various tools for creating animations like support for vector graphics, 3D objects, and complex mathematical equations. 
  • Also includes features for creating animations with custom fonts, styles, and colors. 

plotly.py 

  • Is a Python library used to create interactive data visualizations, built on the plotly JavaScript library that allows developers to create various interactive plots.   
  • Is designed to be easy to use and includes different resources and tools for creating high-quality visualizations. 
  • Includes support for complex data structures like pandas DataFrames and offers various customization options for fonts, styles, and colors. 

seaborn

  • Is a Python data visualization library based on Matplotlib, offering a high-level interface to create attractive and informative statistical graphics.  
  • Offers various plotting functions for visualizing various data types like continuous data, data distribution, and categorial data.  
  • Its the ability to create visually appealing plots with minimal effort and supports the customization of plot elements like axes, titles, legends, and labels. 

moviepy

  • Is a Python library for video editing, concatenations, cutting, video composting, title insertions, creation of custom effects, and video processing. 
  • Has the ability to add audio to video clips easily and offers various filters and audio effects like changing pitch and speed, adding sound effects, and adjusting volume.  
  • Includes support for creating animations like moving text, images, and shapes and allows users to export their video clips to different file formats. 

termtosvg 

  • Is a Python library that allows users to record terminal sessions and save them as SVG animations.  
  • Produces clean-looking and lightweight still frames embeddable on the project page or animations.  
  • Includes support for recording multiple terminal sessions, allowing users to control the size and speed of the resulting animation.   

altair

  • Is a declarative statistical visualization library that can help you spend more time understanding your data and its meaning. 
  • Offers a simple syntax for creating different visualizations, like line charts, histograms, scatterplots, and bar charts. 
  • Its declarative syntax lets user's express visualizations as a series of high-level mappings between visual and data properties like color, size, and position. 

PathPlanning

  • Is a Python library used for path and motion planning applications designed to be accessible to beginners and experts with a straightforward API. 
  • Offers various algorithms for computing collision-free paths for drones, mobile robots, and manipulators in 2D and 3D environments. 
  • Also offers tools for trajectory generation, motion control, and obstacle avoidance and supports simulation and visualization of robot motion. 

alive-progress 

  • Is a Python library for displaying spinners and progress bars in command-line applications designed to offer a customizable way of showing progress indicators for long-running processes or tasks. 
  • Supports for pausing and resuming progress indicators, nested spinners, and progress bars. 
  • Designed to be intuitive and simple with various default settings and a straightforward API for customizing the behavior and appearance of spinners and progress bars. 

asciimatics 

  • Is a package for helping people create full-screen text UIs on any platform and offers a single cross-platform Python class to do all the low-level console functions. 
  • Includes cursor positioning, mouse input, screen scraping, colored/styled text, detecting and handling if the console resizes, and keyboard input like Unicode support. 
  • Is a Python library for creating text-based animations and user interfaces in the terminal. 

pygal 

  • Is a Python library for creating interactive Scalable Vector Graphics (SVG) graphs and charts. 
  • Offers various tools for generating customizable charts, graphs, and high-quality for use in presentations, reports, and web applications. 
  • Includes built-in support for data/time axis labeling, responsive design, and integration with web frameworks and interactive charts elements.   

GANimation 

  • Is a Python implementation of the GANimation research project, which offers various tools for generating animations from still images using Generative Adversarial Networks (GANs).  
  • Includes tools for augmenting and preprocessing input data, customizable GAN training parameters and architecture, and support for evaluating and visualizing GAN models.  
  • Offers various tools for fine-tuning GAN models and generating high-quality animations for various applications. 

deep-motion-editing 

  • Offers advanced and fundamental functions to work with 3D character animations in deep learning with Pytorch. 
  • Is a Python implementation of the research project of the same name, which offers tools for editing the motion of human characters in video sequences using deep learning methods.  
  • Its ability to generate realistic, high-quality animations for various applications offers tools for fine-tuning the deep learning model and editing the generated motions to achieve the desired results. 

geoplotlib 

  • Is a Python library for creating geographical maps and visualizations and offers an easy-to-use interface for creating maps with different data types, like polygons, heatmaps, lines, and points. 
  • Includes support for different tile providers and map projections, customizable styling options for data layers like size, transparency, and color. 
  • Designed for creating interactive maps and visualizations and is suitable for various applications like data analysis, presentation, and exploration. 

Linux-Fake-Background-Webcam 

  • Is a Python library that will allow users to replace their webcam background with a custom video or image on Linux systems.  
  • Works by creating a virtual webcam device that can be selected as the input source in video conferencing applications, allowing users to appear as if they are in various environments and locations.   
  • Includes the ability to control the position and size of the custom background video or image and support for replacing the webcam background with a custom video or audio. 

celluloid 

  • Is a Python library that offers a simple interface for creating visualizations and animations in Matplotlib   
  • Designed to make it easy for users to create animations without having to write to deal with low-level details and complex code.  
  • Includes a simple interface for adding and updating data in the animation, the ability to save the animation as an MP4 or GIF video file, and support for customizing the animation style and appearance. 

FAQ

What are the best data visualizations for Python animation libraries?  

The Python Animation libraries create amazing visuals that can move and change. Here are the best data visualization libraries:  

  • Matplotlib  
  • Bokeh  
  • Plotly  
  • Pygal  
  • Plotnine  
  • Seaborn  
  • Holoviews  

  

Which animation library is most used by Python coders today?  

Matplotlib is a powerful 2D plotting library. It supports various visualizations. It is used in the scientific and data analysis communities. The 'FuncAnimation' class provides its animation capabilities. It allows coders to create dynamic and interactive visualizations. Its popularity is due to its advanced development, clear documentation, and reliability. Other higher-level visualization libraries use it as the backend.  

  

How can I create explanatory math videos using a Python animation library?  

You can use a Python Animation library to make math videos that show concepts visually. You should follow the below steps:  

  • Choose a Python animation library  
  • Plan your content  
  • Write the Python code  
  • Animate with time  
  • Narrate or annotate  
  • Export the video  
  • Edit and visualize  
  • Share your video  

  

What does the code for a basic Python animation look like?  

You can make a simple animation in Python with different libraries. Many people like using the matplotlib library. Matplotlib, a strong Python library, can make plots and do basic animations.   


Here's an example of a basic Python animation using matplotlib:   

import numpy as np   

import matplotlib.pyplot as plt   

from matplotlib.animation import FuncAnimation   

# Function to update the plot in each animation frame   

def update(frame):   

   # Clear the previous plot   

   plt.cla()   

   # Generate some data points for the animation   

   x = np.linspace(0, 2*np.pi, 100)   

   y = np.sin(x + 2*np.pi*frame/100)   

   # Plot the data   

   plt.plot(x, y)   

   plt.xlabel('X')   

   plt.ylabel('Y')   

   plt.title('Basic Python Animation')   

   plt.grid(True)   

# Create a blank figure   

fig, ax = plt.subplots()   

# Create the animation with the update function, 100 frames, and 100ms delay between frames   

animation = FuncAnimation(fig, update, frames=100, interval=100)    

# If you want to save the animation as a video file, you can use the following line:   

animation.save('basic_animation.mp4', writer='ffmpeg', fps=30)   

 # Display the animation   

plt.show()   

  

This code creates a simple animation that displays a sine wave. The update function makes new data points and updates the plot in each animation frame. The FuncAnimation class controls the animation. It calls the update function many times with different frame values.  

In this example, the animation has 100 frames with a delay of 100 milliseconds between frames.


To save the animation as a video file: 

  1. Remove the comment from the animation. 
  2. Save line. 
  3. Make sure you have ffmpeg installed. 
  4. Before running the code, ensure you have installed matplotlib in your Python setup. You can install it using pip install matplotlib.  

 

Using an animation library, how can you make line charts with various colors in Python?  

You can use different libraries in Python to make line charts with colors and animations. I will teach you how to use Matplotlib's FuncAnimation to animate graphs.   

  

Here's a step-by-step guide:   

#Install the required libraries (if you haven't already)   

pip install matplotlib   

# Import the necessary modules   

import numpy as np   

import matplotlib.pyplot as plt   

from matplotlib.animation import FuncAnimation   

# Generate your data: Create multiple datasets with different colors. For this example, let's consider two datasets, data1 and data2   

x = np.linspace(0, 10, 100)   

data1 = np.sin(x)   

data2 = np.cos(x)   

# Create a figure and an axis to plot the data   

fig, ax = plt.subplots()   

# Define the line objects for each dataset and set their properties   

line1, = ax.plot([], [], color='red', label='Data 1')   

line2, = ax.plot([], [], color='blue', label='Data 2')   

# Define the initialization function for the animation   

def init():   

   line1.set_data([], [])   

   line2.set_data([], [])   

   return line1, line2   

# Define the update function for the animation   

def update(frame):   

   line1.set_data(x[:frame], data1[:frame])   

   line2.set_data(x[:frame], data2[:frame])   

   return line1, line2   

# Create the animation using FuncAnimation   

frames = len(x)   

animation = FuncAnimation(fig, update, frames=frames, init_func=init, blit=True)   

# Display the animation or save it to a file (optional)   

plt.legend()   

plt.xlabel('X-axis')   

plt.ylabel('Y-axis')   

plt.title('Animated Line Chart with Different Colors')   

plt.show()   

   

This code makes a line chart that shows two datasets using different colors. You can customize the colors, data, and other properties per your requirements. To add more datasets, make new line objects and update their data in the update function.   

  

Can FuncAnimation be used to animate 3D objects and 2D shapes in Python?  

Yes, 'FuncAnimation' can animate both 3D objects and 2D shapes. But 'FuncAnimation' is a part of the Matplotlib library. It is primarily known for 2D plotting. Matplotlib's 3D plotting toolkit makes 3D objects, and visualizations come to life.  

  

Are there any tips or tricks to improve creating animations with Python libraries?  

To improve your animations, follow these helpful tips and tricks for efficient engineering. Here are some valuable tips to help you with it:  

  • Plan your animation  
  • Keep it simple  
  • Use subplots  
  • Choose the right library  
  • Optimize data processing  
  • Minimize redrawing  
  • Control animation speed  
  • Add labels and annotations  
  • User color thoughtfully  
  • Consider interactivity  
  • Test on a smaller subset  

  

Can I find open-source projects to practice coding with a Python animation library?  

Yes, there are many open-source projects available that use Python animation libraries. These resources help you practice animation libraries before starting your own project. Here are some places where you can find such projects:  

  • Matplotlib Examples Gallery  
  • GitHub Repositories  
  • Plotly Examples Gallery  
  • Kaggle Notebooks  
  • Bokeh Examples Gallery  
  • Data Science Blogs  
  • YouTube Tutorials 

React libraries enable developers to craft fluid user interfaces with reusable, ready UI code components. Creating animations is more convenient with the JavaScript virtual DOM programming model of React as compared to the traditional DOM, which helps in boosting performance. Props-based data binding in React libraries enables better flow, efficient debugging and also helps developers reduce some of the boilerplates. Using React libraries gives a coder a cleaner, more responsive approach to animations since the code is easier to reason about. An open platform React animation library supports full-stack programming, making it a holistic solution for web and app-based animations. Presented below is an updated JavaScript library list for React animation packages. lottie-web - Effects animations natively; react-motion - A spring that solves your animation problems; react-native-animatable - Standard set of easy to use animations.

 

Matplotlib is a popular Python 2D plotting library. It provides a powerful framework for creating animations using its `FuncAnimation` class. This functionality allows you to generate animated and interactive charts. It makes your visualizations more dynamic and engaging.  

General steps to use FuncAnimation class: 

  • To begin, ensure you have Matplotlib installed with any necessary libraries. If you're using a virtual environment, create a new Python virtual environment. Then, we can install the required packages.  
  • Import the necessary libraries. Import `matplotlib.pyplot` as `plt` and `matplotlib.animation` as `animation`. Import other libraries for data manipulation specific to your project.  
  • Next, create the base graph or plot objects on which the animation will be built. For example, you can create a line plot, scatter plot, bar chart, or any other type of plot that suits your data. Set up the initial plot with empty data or any initial state you want for the animation.  
  • To define the animation, create a function animate. It will be invoked for each frame of the animation. The function should take a frame number argument, `frame,` which can update the plot for the next frame. Upgrade the plot objects based on the frame number inside the' animate' function. It creates the animation effect.  
  • To animate the plot, create an instance of the `FuncAnimation` class. Provide the figure object, the `animate` function, and any extra parameters required. This will create the actual animation object.  
  • Finally, display or save the resulting animation. If you want to display it, use the `plt.show()` function. If you prefer to save it as a file, use the `animation.save()` method with the appropriate writer.  


Throughout the process, you have control over various aspects of the animation. You can customize the appearance of the animation to create sophisticated visualizations.  

 

When working with large data, creating animations showcases time-series or time-dependent data. By adding motion to your plots, you can capture dynamic patterns. It changes that static charts may not convey.  

 

The coding process for creating animations with Matplotlib is straightforward. It can be done in your preferred Python development environment. Jupyter Notebooks or integrated development environments can streamline the coding and testing process.  

 

With its interactive and dynamic nature, animation functionality opens possibilities for various applications. It can be used for anything from physics simulations and art animations. It helps data visualizations that need an animated element.  

 

Remember to consider the rendering backends and requirements specific to your project. For instance, if you create animated files, you have the necessary libraries installed. Adjust the code to match your desired output format and specifications.  

How to Create animations in Matplotlib using the FuncAnimation class? 

For making animated visualizations, Matplotlib's FuncAnimation class is a helpful resource. First, construct a figure and axis object. It helps plot your initial data before you can use FuncAnimation. The data in your plot is then updated by a function you write. This FuncAnimation function calls at predetermined intervals. It updates the data and provides a string of Artist objects representing the revised plot. You can refresh the information in your plot at predetermined intervals. It will provide the impression of motion or change over time.  

 

The 'im' object in Matplotlib is an instance of the 'imshow' class used to display a 2D array as an image. The data shown in the image is updated for each animation frame using the set array method of the 'im' object.  

 

We instruct FuncAnimation to update each frame rather than redrawing the full figure by returning from the animate function. Especially for large visualizations, this can lead to greater performance and smoother animations.  

 

The FuncAnimation object contains the data required to produce and control the animation. It is returned by the create video function's return anim statement. 


Preview of the output obtained when funcAnimation class is used.

Code

The im object in Matplotlib is an instance of the imshow class that is used to display a 2D array as an image. The data shown in the image is updated for each frame of the animation using the set array method of the im object.

We are instructing FuncAnimation to update only the im object on each frame rather than redrawing the full figure by returning im from the animate function. Especially for large and complicated visualisations, this can lead to greater performance and smoother animations.

The FuncAnimation object, which contains all the data required to produce and control the animation, is returned by the create video function's return anim statement.

Follow the steps carefully to get the output easily.

  • Install Visual Studio Code in your computer.
  • Install the required library by using the following commands

pip install matplotlib

pip install numpy


  • If your system is not reflecting the installation, try running the above command by opening windows powershell as administrator.
  • Open the folder in the code editor, copy and paste the above kandi code snippet in the python file.
  • Remove the first line of the code.
  • Run the code using the run command.


I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for "Create animations in Matplotlib using the FuncAnimation class" in kandi. You can try any such use case!

Dependent Libraries

If you do not have numpy and matplotlib that is required to run this code, you can install it by clicking on the above link and copying the pip Install command from the pages in kandi.


You can search for any dependent library on kandi like matplotlib.

Environment tested

  1. This code had been tested using python version 3.8.0
  2. numpy version 1.24.2 has been used.
  3. matplotlib version 3.7.1 has been used.

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

FAQ 

1. What is the Python 2D plotting library, and how can it be used to create animated and interactive charts?  

The 2D plotting library provides a comprehensive set of functions. It helps in creating static and dynamic visualizations. It can create animated and interactive charts by leveraging the `FuncAnimation` class. It allows you to update plots for each frame and create engaging visual experiences.  

 

2. How do I create an animated line plot with the Python 2D plotting library?  

To create an animated line plot using the Python 2D plotting library (Matplotlib):  

import matplotlib.pyplot as plt;  

plt.plot(x, y);  

plt.show()  

Replace `x` and `y' with the appropriate data for the line plot and execute the code to display the animated line plot.  

 

3. What is the animation framework of matplotlib, and what are its uses?  

The animation framework provides functionality to create animated visualizations. It updates plot elements over time. It allows for the creation of dynamic and interactive charts. It enables the representation of time-dependent data, simulations, and other scenarios. It is where motion enhances data understanding, engagement, and storytelling.  

 

4. What arguments does the animation function accept to work with matplotlib?  

The `animation.FuncAnimation` function in Matplotlib accepts the following arguments:  

  • `fig`: The figure object or figure number to which the animation will be associated.  
  • `func`: The function that will be called for each animation frame.  
  • `frames`: The total number of frames in the animation.  
  • `init_func` (optional): A function that initializes the animation before the frames are drawn.  
  • `interval` (optional): The delay between frames in milliseconds.  
  • `repeat` (optional): Boolean value indicating whether the animation should repeat.  
  • `blit` (optional): Boolean value indicating whether to use blitting for faster updates.  

 

5. Is there any Python module that needs to be imported for animating objects in matplotlib?  

Yes, for animating objects, you need to import the matplotlib.animation module. This module provides the necessary classes and functions. It helps create and control animations within Matplotlib. 

Here are some famous React Animation Bot Libraries. Some of the use cases of React Animation Libraries include Creating custom page transitions, animating user interface elements, animating data visualisations, Animating complex user interfaces. 


React animation libraries are JavaScript libraries that provide a set of tools to animate components in a React application. These libraries make it easy to animate various components such as buttons, dropdowns, modals, and other user interface elements. They provide powerful APIs that allow developers to create complex animations with minimal code. 


Let us look at the libraries in detail below. 

react-spring 

  • Utilizes physical equations and damping functions to create realistic and natural animations. 
  • Integrates with any other animation library. 
  • Highly optimized for performance, making it a great choice for complex animations. 

react-native-reanimated 

  • Support for both imperative and declarative APIs. 
  • Support for interpolation and value transformations. 
  • Ability to use native platform-specific animations (e.g., spring animations on iOS). 

animated 

  • Provides a comprehensive and flexible API for declarative and imperative animation control. 
  • Only library to offer React Native support. 
  • Allows developers to animate components directly from the React Native bridge.

react-anime 

  • Modular structure allows developers to create custom animations from individual components. 
  • Allows developers to create smooth transitions between different states of their animation. 
  • Offers unique easing functions to create a variety of animation styles. 

react-animation 

  • Supports both CSS and JavaScript animations, making it easy to customize and animate components. 
  • Offers a wide variety of animations such as sliding, fading, and scaling. 
  • Allows developers to chain multiple animations together to create complex sequences. 

moti 

  • Advanced features such as timeline-based animation sequencing. 
  • Supports both native and JavaScript-based animations. 
  • Includes an extensive library of pre-built animations. 

Resonance 

  • Offers a robust set of tools to customize and manage animations. 
  • Designed to be performant, meaning that animations run smoothly on all devices. 
  • Provides an easy way to create complex animations, along with a variety of interpolation methods and easing functions. 

react-animation-comparison 

  • Provides a comprehensive suite of tools and features. 
  • Powerful animation library and an intuitive GUI. 
  • Has a built-in timeline and animation editor. 

renature 

  • Lightweight library that is designed to make animations easy to implement. 
  • It offers a wide range of animation options. 
  • Provides an animation editor that allows users to generate animations quickly and easily. 

Lottie-react 

  • Completely open-source, allowing developers to customize and extend the library as they see fit. 
  • Extremely lightweight and fast-loading. 
  • Declarative API for easily adding complex animations to React components. 

Here is a list of the best Swift/iOS animation libraries for 2023 that developers can use to create immersive animations for mobile app development.


Animations can make a huge difference in user experience. Animation Libraries are a great way to add dynamic animations to the app. Correctly implemented, functional, beautiful animations are a joy for users and will help keep them engaged in the app. These libraries cover everything from user interface design to app analytics in a way that makes it very easy to implement animation in projects.


We have curated a list of the ten best Swift/iOS animation libraries that each provide a unique function.

Lottie-web 

  • Useful in adding animated icons and illustrations.
  • Helps load animations.
  • Helps in animated backgrounds.

react-motion 

  • Allows beautiful animations and transitions with a simple syntax.
  • Customizes the timing and duration of animations.
  • Helps in creating complex animations and transitions with ease.

Hero 

  • Helpful in custom navigation transitions.
  • Helps in creating interactive animations when tapping on views.
  • Helps in creating personalized presentation transitions.

SkeletonView 

  • Represents the structure of the UI.
  • Helps in customizing the look of the skeleton screens.
  • Creates empty screen animations.

ViewAnimator

  • Helps in animating views with ease.
  • Allows customizable animations with different directions, delays, and durations.
  • Helps in combining multiple animations for complex effects.

SwiftMessages

  • Allows custom in-app notifications to come up with animations.
  • Allows customizable designs for alerts and banners.
  • Shows toast notifications.

LiquidLoader.

  • Creates a Fun, liquid-style loading animation.
  • Allows customizable animations with different colors and shapes.
  • Helps in modifying loading animations for buttons and UI elements.

AnimatedCollectionViewLayout 

  • Customizes the animation style and direction.
  • Helps in supporting different types of cells.
  • Creates 3D effects.

LNZCollectionLayouts 

  • Has custom collection view layouts for unique designs.
  • Allows supporting different layout styles, such as circular and spiral.
  • Provides dynamic resizing and animation of cells.

Shimmer

  • Helpful in table view and collection view loading animations.
  • Used for empty screen placeholder animations.
  • Mimics the look of reflective surfaces.

Here are some of the Android Animation Libraries. Some of the use cases of Android Animation Libraries include Creating complex UI elements, enhancing user experience, enhancing game development, and Creating app-specific animations. 


Android Animation Libraries are collections of code libraries and tools for creating and animating graphics for Android applications. The libraries include a variety of animation techniques, such as keyframing, and physics-based animation, which can be used to create dynamic and interactive visual elements. 


Let us look at the libraries in detail below. 

rebound 

  • Uses a spring physics model to create animations. 
  • Designed to be used with the Android UI toolkit. 
  • Highly customizable. 

lottie-android 

  • Highly efficient and supports vector-based animations. 
  • Compatible with both Android and iOS devices. 
  • Allows you to create complex animations with a few simple lines of code

Android-Animation-Set 

  • Has no bugs, has no vulnerabilities. 
  • Has a Permissive License and it has medium support. 
  • Used in Telecommunications, Media, Telecom, User Interface, Animation applications. 

recyclerview-animators 

  • Uses less memory and fewer resources than other animation libraries. 
  • Allows you to tweak and customize the animations to suit your needs.  
  • Has built-in support for a range of animations, including alpha, translate, rotation, and more.  

ViewAnimator 

  • Allows developers to mix and match different animations to create complex effects.   
  • Has excellent documentation and a wide range of tutorials available. 
  • Animations created can be reused in multiple activities or applications. 

Swirl 

  • Doesn’t require a lot of setups and is easy to use.  
  • Provides a wide range of customization options.  
  • Has a powerful timeline feature that enables developers to animate objects across a timeline in a single line of code. 

Animated-icons 

  • Require less memory than many other animation libraries, making them ideal for mobile applications. 
  • Have a smaller code base than most other animation libraries. 
  • Are designed to be responsive, so they will resize and adapt to different screen sizes.

RxAnimation 

  • Create animations that span multiple platforms, including iOS and Windows. 
  • Able to create animations that are synchronized with user input.  
  • Allows developers to create custom animations according to their specific needs.  

React parallax libraries help incorporate parallax scrolling effects into their React applications. React parallax libraries are important tools for creating an engaging user interface. The depth illusion creation method is called Parallax scrolling. We can move elements at different speeds as the user scrolls through a webpage.  

 

React parallax libraries offer ready-made components and APIs. It simplifies the implementation of parallax effects. The complexities of handling scroll events, animations, and calculations are abstracted. It focuses on the creative aspects of design rather than the technical intricacies.  

 

React parallax libraries empower developers. It helps create engaging user interfaces without having to reinvent the wheel. The React parallax libraries provide a streamlined way to incorporate parallax effects. It enhances the user experience and makes applications more captivating and memorable. 

 

Here are the best libraries organized by use cases. The best libraries are React-scroll-parallax, React-spring-parallax, React-parallax, React-native-parallax-scrollview, React-parallax-component, React-simple-parallax, and React-rellax-wrapper. A detailed review of each library follows.  

 

Let's look at each library in detail. The links allow you to access package commands, installation notes, and code snippets.  

react-scroll-parallax:  

  • It is a library for creating parallax effects in React applications.  
  • It provides hooks to interact with the parallax state and create custom animations.  
  • It is a powerful library. It simplifies adding parallax effects to your React applications.  
  • The ParallaxGroup component is used to group many Parallaxes or ParallaxBanner components. 

react-springy-parallax:  

  • It provides a parallax effect for applications using the React Spring animation library.  
  • It lies in their ability to enhance the user experience and add visual interest to web pages.  
  • Like other React libraries, it is built using JavaScript. It is compatible with various platforms and devices.  
  • It offers a powerful toolset to create stunning and engaging web experiences. 

react-parallax:  

  • It allows you to create parallax scrolling effects in React applications.  
  • It provides a set of components and utilities. It will simplify the process of implementing parallax effects.  
  • It also provides extra utilities and features. The features include event callbacks, custom scroll handling, and configuration options. It helps fine-tune the parallax behavior.  
  • It manages the state. It provides the necessary context for the parallax components to function.  

react-native-parallax-scrollview:  

  • It enables the implementation of parallax scrolling effects in applications built with React Native.  
  • These are optimized for performance. It ensures smooth scrolling and rendering of parallax effects, even in complex scenes.  
  • It inherits all the features and capabilities of the standard ScrollView component.  
  • It allows you to create complex and stunning scenes with layered content.  

react-parallax-component:  

  • These are designed to create parallax scrolling effects in React applications.  
  • It offers various properties or settings. It allows you to customize the parallax effects.  
  • It tracks the scroll position of the container. It calculates the position and movement of each layer based on that.  
  • It provides a container component. It wraps the content or components you want to apply the parallax effect.  

react-simple-parallax:  

  • It helps in creating parallax effects in React applications.  
  • It provides a straightforward setup process.  
  • It is designed to be responsive. It ensures that the parallax effect works across different screen sizes and devices.  
  • It provides support for user interaction with parallax layers. 

react-rellax-wrapper:  

  • It helps integrate the Rellax library into a React application.  
  • It can leverage these features to handle state changes. It leverages reaction to user interactions and updates the parallax effect.  
  • It helps maintain reactivity and performance, even in complex React applications.  
  • It enhances the development experience and flexibility when implementing parallax effects. 

FAQ:  

1. What is the react-parallax component, and how does it work?  

The "react-parallax" component is a React library. It allows you to create parallax scrolling effects in your web applications. Parallax scrolling is a technique. It's where background images move at a different speed. The speed will vary from the foreground content while scrolling. It helps in creating an illusion of depth and adding an appealing effect. Here's a basic overview of how the "react-parallax" component works:  

  • Install the library.  
  • Import the component.  
  • Set up the parallax container.  
  • Define parallax layers.  
  • Add content to layers.  
  • Customize and style.  
  • Test and refine.  

 

2. How can I adjust the parallax effect strength for my web design?  

Adjusting the parallax effect strength involves modifying the CSS properties. Here's a general approach to adjusting the parallax effect strength:  

  • Structure your HTML.  
  • Set up CSS properties.  
  • Adjust the parallax effect.  
  • Test and iterate.  

 

3. Is there a way to blur the background image in a React project using their React parallax library?  

The React Parallax library is designed for creating parallax effects. It involves elements scrolling at different speeds to create a sense of depth. It doesn't provide a built-in feature to blur the background image. But you can achieve the desired effect of blurring the background image. You can do so by combining the React Parallax library with other CSS techniques.  

 

4. What are some basic uses of a background image with this react parallax library?  

A background image can add depth and visual interest to your website or application. Here are some basic uses of a background image with a React parallax library:  

  • Hero sections  
  • Section separators  
  • Call to action (CTA) sections  
  • Landing pages  
  • Portfolio Showcase  
  • Storytelling elements  

 

5. How do I use scroll animations in React projects with this React parallax library?  

To use scroll animations with a library, you can follow these steps:  

  • Install the library.  
  • Import the necessary components.  
  • Set up the scroll animations.  
  • Customize the animation.  
  • Style your components. 

React is a well-known JavaScript toolkit to generate reusable UI components that may be combined to create intricate and dynamic online apps. JavaScript is a popular programming language for developing interactive and dynamic web experiences. It is the fundamental language of the internet, and all current web browsers support it.  

Web apps are frequently created using a combination of React and JavaScript. React uses JavaScript to create and modify the user interface (UI), manage user interactions, and update the React components. Using the strength of React and the adaptability of JavaScript, you can do this to develop rich and interactive online applications. Framer Motion is a popular open-source animation library for React. It offers a straightforward and clear API for developing animations and gesture-based interactions in React and is built on top of the well-known animation library React-Spring.  

Framer Motion has several vital features, including natural gesture-based interactions, a simple and declarative API, automatic animations, server-side rendering, and more.  

This example shows how easy it is to create a slideshow effect with Framer Motion. 



PS: Preview of the output that you will get on running this code from your IDE

Code

In this solution we use the AnimatePresence tag in the react application to achieve it.

  1. Copy the code using the "Copy" button above, and paste it in a react project in your IDE.
  2. Run the application to see a timer which runs with a slideshow effect.


Note that any element can be used inside the motion tag, which will be animated.


I found this code snippet by searching for "Slideshow effect" in kandi. You can try any such use case!

Dependent Libraries

If you do not have react application that is required to run this code, you can install it by clicking on the above link of react page in kandi.

You can search for any dependent library on kandi like React.

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in react v18.2.0 and framer motion v6.2.4
  2. The solution is tested on chrome browser on codesandbox.io

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

Angular Animation Libraries are used for animation-related resources designed for the Angular Framework. Angular Animation Libraries for different processes like Animation Data Visualization and Page Transitions.


These libraries include pre-built animation effects, transitions, and elements. These libraries offer various features for creating engaging and interactive user interfaces. They use a declarative syntax for defining animations, doing reading, and understanding the code easier. Angular animation libraries offer advanced features like SVG, 3D animations, and parallax scrolling. It can be used for creating complex and dynamic user interfaces. It provides interactivity features like click and hover animations. It creates more engagement and interaction. 


Here is a list of handpicked top 9 Angular Animation Libraries of 2024 for your reference:

tsparticles:

  • Is a lightweight JavaScript library that we can use to create particle animations. 
  • Offers an effortless way for adding particle effects to web applications with a focus on flexibility and performance. 
  • Allows customization the particle animations like particle shape, size, density, speed, and color.
  • Making it easy to create a unique and visually appealing particle effect that matches the design and UI goals. 

rxviz:

  • Is a web-based reactive programming framework that visualizes the behavior of RxJS Observables. 
  • Is a popular library for reactive programming in JavaScript and is used in Angular applications. 
  • Offers a graphical representation of Observable streams to visualize how data flows through the application.
  • Making it easy to identify issues and optimize the application behavior. 

angular-scroll:

  • Is an Angular library that offers smooth scrolling animations for web applications.
  • Allows developers to create scrolling animations that smoothly transition between different application sections. 
  • Offers an effortless way to create anchor links that scroll to a specific application section
  • Allows users to navigate to various sections without manually scrolling through the content. 
  • Can create smooth scrolling animations to enhance web applications' visual appeal and UI.

angularjs-slider:

  • Is a library that offers a customizable range slider for AngularJS applications. 
  • Allows developers to create range sliders.
  • Allow users to select a range of values within a defined set, like choosing a range of prices or dates. 
  • Offers a range of customization options that will help developers fine-tune their slider to match the design and UI goals.

ngAnimate:

  • Is a built-in Angular library that offers support for animations in Angular applications.
  • Allows developers to create animations by changing the application state. 
  • Is built into Angular, which makes it easy to add animations to existing applications.
  • Create a new application with built-in animation features. 

delighters:

  • Is an Angular library that offers a straightforward way to add subtle and engaging animations to web pages. 
  • Allows developers to create animations triggered as the user scrolls through the page.
  • Offering a more dynamic and engaging UI. 
  • Is a lightweight library that has minimal impact on the overall performance of the web application. 

angular-svg-round-progressbar:

  • Is an Angular library that offers a circular, customizable progress bar using SVG graphics. 
  • Allows developers to create circular progress, which shows the progress of an ongoing process.
  • Offering a visual cue for users of the application status. 
  • Offers various options to fine-tune the progress bar to match the application's design and user experience goals.

ngx-spinner:

  • Allows developers to customize the loading spinners with diverse options like size, style, and color.
  • Making it easier to create loading spinners that match the design and UI goals. 
  • Can be integrated with different web technologies like React, vanilla JavaScript, and Angular.
  • Making it easier to add loading spinners to the current web applications or create new ones. 
  • Is designed to be accessible with support for screen readers and keyboard navigation.
  • Ensuring users can navigate and interact with the application.

angular-spinner:

  • Is an Angular library that provides an effortless way to add loading spinners for web applications. 
  • Allows developers to create loading spinners that appear if data is fetched or processed.
  • Providing a visual cue to users which application is working. 
  • Offers multiple spinner types, like spinner dots and lines.
  • Allowing developers to choose the spinner type that best fits the application's design and user interface goals.

Python visualization and animation libraries are modules or packages that allow you to create animations, charts, and other graphics using Python code. They usually provide functions or classes that help you manipulate graphical elements such as shapes, colors, images, text, etc., and control their movement, appearance, and behavior over time. Some examples of Python animation libraries are Matplotlib, VPython, and manim.



Python animation libraries are useful for creating dynamic and interactive visualizations of data or objects using Python code. For example, you can use Matplotlib to plot graphs of functions or figures and add animations to them. You can also use VPython to create 3D displays and animations of physical phenomena. Another example is manim, an animation library designed for an intuitive and easy-to-use interface and for explanatory math videos used for programmatically creating precise animations.


Python itself cannot create animation. It can only create images. It needs an external program to create a perception of movement. Python animation libraries may have specific requirements or caveats for creating animations. For example, celluloid requires that the axes limits are the same for all plots and that artists are passed to the legend function separately Plotly has some limitations with 3D animations and interactivity.


Here are some of the top open source Python animation libraries you can leverage in your projects.

Kivy is a Python library and programming language. It helps make cross-platform applications, especially ones with graphical user interfaces (GUIs).


Developers make apps for computers, phones, and other devices that people can enjoy. Kivy is a strong tool for making apps with many widgets and animations. Developers can use it to create many different types of applications.  

Kivy has different animation choices:

  • 2D animations: Basic animations that make flat objects move, resize, or rotate.  
  • Complex Transitions: These are animations. It makes widgets move smoothly between different states for an exciting experience.  
  • Kivy3DGUI: Kivy3DGUI, a part of Kivy, lets developers make 3D animations and interactions.  

Kivy has many animation tools for different needs and levels of complexity. These tools include:  

  • Animation Frames: You need to make frames for each frame using widget properties.  
  • Animation Object: You can add transitions to widget properties for a set time.  
  • AnimationTransition: Exploring different transition functions to control the animation's timing and easing.  

To create an animation in Kivy, developers typically follow these steps:  

  • Design the Scene: Plan the visual layout and widget hierarchy required for the spirit.  
  • Define Animation: Use a tool to specify how widgets move, scale, or transform.  
  • Add Final Touches: Make the animation settings perfect. Adjust duration, looping, and transition functions to add final touches.  

Tips for Animating with Kivy:  

  • Use simple animation tools: Create basic animations with the Animation object. 
  • Manage Multiple Animations: Use the Clock's schedule_interval() method to synchronize multiple animations.  
  • Optimize Performance: To make your device faster, use fewer widgets that move. Only update them when necessary.  

To optimize animations for mobile devices, consider the following:  

  • Reduce File Size: Compress images and assets to minimize the app's file size.  
  • Control Frame Rate: You can adjust the frame rate of animations to balance how they look and perform.  
  • Use Hardware Acceleration: Leverage Kivy's hardware acceleration capabilities to enhance animation performance.  

You can share Kivy animations through various means: 

  • Web Galleries: Publish animations on personal websites or web galleries to showcase work.  
  • Social Media: To reach more people, share animations on YouTube, Instagram, and Twitter.  

   

Kivy is a flexible and effective tool for making animations. You can create basic 2D transitions or advanced 3D interactions. Developers can design attractive and interactive applications using animation tools and widgets. Kivy works on many platforms and devices, making it popular for interactive animations. Kivy is a useful tool for energy and GUI programming. You can use it in open-source projects, mobile apps, and online showcases. Its simplicity and versatility make it valuable.  

CODE

  1. Copy the code using the "Copy" button above, and paste it into a Python file in your IDE.
  2. Modify the code appropriately.
  3. Run the file to check the output.


I hope you found this helpful. I have added the link to dependent libraries and version information in the following sections.

Dependent Libraries

Environment Tested

I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in Python3.11.
  2. The solution is tested on kivy 2.2.1 version.

FAQ 

1. Which programming language uses Kivy to create animations?  

The programming language used to create animations with Kivy is Python. Kivy is a Python framework that has tools and widgets for GUI programming. It also has animation capabilities. Python's simplicity and readability make it great for creating interactive animations with Kivy.  

   

2. How do you develop an application that uses Kivy animation?  

To develop an application that uses Kivy animation, you need to follow these steps:  

a. Install Kivy: Make sure you have Kivy installed in your Python environment.  

b. Import Kivy Modules: Import the required modules to use the Kivy library in your Python code.  

c. Design the Interface: Create the visual layout of your application using Kivy widgets.  

d. Define Animation Logic: You can control how widgets move, change size, and rotate.  

e. Bind Animation to Events: Connect animations to button presses or screen transitions.  

f. Run the Application: To watch your animations, open the Kivy app with Python.  

   

3. How can I use the Button widget in a Kivy animation?  

To make interactive user interfaces in Kivy animations, use the Button widget. It's engaging and fun. When you add animations to the button, it shows visual feedback when the user presses it. You can make the button look different when clicked by using the Animation class. This makes the user experience more interesting.  

   

4. What is the animate method, and how does it work in Kivy?  

Kivy's animation method is a convenient way to animate widget properties. This is a feature in the Animation class. You can choose a widget, its properties, values, and how long the animation lasts. Using the animate method makes the widget look graceful as the spirit moves and changes it. It goes from the initial state to the specified target values over a set duration. You can easily make smooth and pretty animations in Kivy using this method.  

   

5. How can I use BoxLayout to create complex animations with Kivy?  

To make advanced animations with Kivy, arrange widgets flexibly and dynamically using BoxLayout. BoxLayout arranges child widgets either horizontally or vertically. You can choose how to distribute and align the widgets within the layout. You can make widgets slide, fade, or resize together by using BoxLayout and animations. You can change the BoxLayout's size to show or hide its child widgets. This creates cool and interesting animations in your Kivy app.  

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

Pygame provides a framework for developing 2D games. This provides multimedia applications and interactive software using the Python programming language. It offers a range of functionality for handling graphics, sound, and user input. These make it a powerful tool for creating games and interactive experiences. Pygame provides an API for game development. It is a great choice for creating 2D video games and animations.  

 

It is developed on the Simple Direct Media Layer (SDL). Pygame provides an abstract layer that simplifies the process of game development. It allows developers to focus on the game logic. Also, it allows us to focus on design without getting involved in low-level details.  

 

Here are some key features and capabilities of Pygame:  

  • Graphics  
  • Input handling  
  • Sound and music  
  • Collision detection  
  • Game development utilities  


Pygame's versatility extends beyond game development. It can be used for creating interactive visualizations. It is used in educational software, simulations, and other graphical applications. Pygame provides simplicity and ease of use. This makes it a popular choice for both beginner and experienced developers.  

 

Pygame is a popular Python library for creating 2D games and animations. Here are some examples:  

  • Object Movement - Pygame allows you to animate objects. It is done by updating their positions over time.  
  • Sprite Animation - Sprites are images or visual elements that can be moved or animated.  
  • Frame-Based Animation - Pygame allows you to load a series of individual frames. It displays them at a specific frame rate, creating frame-based animations.  
  • Shader-Based Animations - Pygame provides support for using shaders. They are small programs that run on the GPU to manipulate the appearance of objects.  
  • 3D Animations - Pygame's 3D capabilities are limited compared to dedicated 3D engines.  


Pygame is a 2D game development library for Python. So it doesn't support advanced animation engines like Blender, Maya, or 3D Studio Max. Let's explore how Pygame can work with each of these animation engines:  

  • Blender: Blender is a powerful open-source 3D creation suite. That includes robust animation capabilities.  
  • Maya: Autodesk Maya is a used 3D computer graphics application. It offers comprehensive tools for modeling, animation, and rendering.  
  • 3D Studio Max: 3D Studio Max (often referred to as 3ds Max) is another popular 3D modeling. It is also known as animation software.  


Pygame provides functionality for handling graphics, sound, and user input. Here's a brief overview of how you can use Pygame to create video games:  

  • Installation - Start by installing Pygame on your system.  
  • Setting up the game window - Import the Pygame library and initialize it using pygame.init().  
  • Game loop - Create a game loop until the player quits the game.  
  • Handling user input - Check for user input events and respond inside the game loop.  
  • Drawing graphics - Use Pygame's drawing functions to create graphics for your game.  
  • Collision detection - Install collision detection logic to handle interactions between game objects.  
  • Game logic and mechanics - Develop the core gameplay mechanics of your game.  
  • Sound and music - Pygame also provides functionality for playing sound effects. Also, it provides music in your game.  
  • Level design - Design levels or game worlds by creating appropriate data structures. This helps to represent the layout of the game.  
  • Testing and refining - Test your game to identify bugs or areas that need improvement.  
  • Packaging and distribution - Once your game is complete, you can package it as an executable. It is a Python script and any necessary assets, such as images or sound files.  


In conclusion, Pygame stands out as a powerful tool for animation due to its simplicity. It has built-in functionality, versatility, and strong community support. Its unique features empower animators to bring their creative visions to life. This is used to explore the endless possibilities of animation in various domains. Whoever you are, Pygame offers an accessible and robust platform. This will unleash your imagination and create captivating animations.  


Here is an example of creating and displaying simple animations in Pygame.




Fig1: Preview of the Code



Fig2: Preview of Output when the code is run in IDE.

Code


In this solution, we are creating and displaying simple animations using Pygame

Instructions

Follow the steps carefully to get the output easily.

  1. Install Jupyter Notebook on your computer.
  2. Open terminal and install the required libraries with following commands.
  3. Install pygame - pip install pygame.
  4. Copy the code using the "Copy" button above, and paste it into your IDE's Python file.
  5. Run the file to get the desired output.


I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for "Text animations in pygame" in kandi. You can try any such use case!

Dependent Libraries


If you do not have Pygame that is required to run this code, you can install it by clicking on the above link and copying the pip Install command from the Pygame page in kandi.


You can search for any dependent library on kandi like pygame.

Environment Tested


I tested this solution in the following versions. Be mindful of changes when working with other versions.

  1. The solution is created in Python 3.9.6
  2. The solution is tested on pygame version 2.3.0


Using this solution, we are able to create and display simple animations using Pygame.

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

FAQ:  

1. What is pygame animation, and how does it work?  

Pygame is a popular Python library. It is used for developing 2D games and multimedia applications. Animation can be achieved by updating the appearance of objects in each frame of the game loop.  

 

The basic steps involved in creating a pygame animation are as follows:  

  • Set up the Pygame environment. 
  • Load and prepare the images.  
  • Create game objects.  
  • Create the game loop.  
  • Add animation logic.  
  • Add timing and control.  

 

2. How do I create animated sprites for a game screen?  

Creating animated sprites for a game screen involves several steps. Here's a general process you can follow:  

  • Design your sprite. 
  • Break down the animation.  
  • Create individual frames.  
  • Arrange frames into a sprite sheet.  
  • Define animation timing.  
  • Implement the animation.  
  • Test and refine.  

 

3. What is the frame rate for pygame animation?  

The frame rate for animation is determined by the number of frames displayed per second. By default, Pygame does not impose a specific frame rate, allowing you to control it. You can set the desired frame rate by including a delay between frames in your game loop.  

 

4. How do I write a game loop to run an animation in Pygame?  

To create a game loop in Pygame to run an animation, you can follow these general steps:  

  • Import the necessary Pygame modules. 
  • Define the position, speed, and other necessary properties for your animation.  
  • Create a main game loop using the while statement. This loop will update the game state and render the animation.  
  • After the main loop, add the code to quit Pygame. 

 

5. Can you explain what a sprite sheet is and how one can be used in Pygame?  

A sprite sheet is an image file. It contains many smaller graphics or animation frames arranged in a grid-like structure. Here's a general approach for using a sprite sheet in Pygame:  

  • Prepare the sprite sheet.  
  • Load the sprite sheet.  
  • Extract individual sprites.  
  • Create sprite objects.  
  • Animation and rendering. 

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <style>

    body {

      text-align: center;

      font-family: 'Arial', sans-serif;

    }


    #character {

      width: 200px;

      height: 300px;

      border: 2px solid #000;

      margin: 20px;

    }

  </style>

  <title>Anime Character Generator</title>

</head>

<body>

  <h1>Anime Character Generator</h1>

  <div id="character"></div>

  <button onclick="generateCharacter()">Generate Character</button>


  <script>

    const hairstyles = ["hairstyle1", "hairstyle2", "hairstyle3"];

    const eyecolors = ["blue", "green", "brown"];

    const outfits = ["outfit1", "outfit2", "outfit3"];


    function getRandomElement(array) {

      const randomIndex = Math.floor(Math.random() * array.length);

      return array[randomIndex];

    }


    function generateCharacter() {

      const hairstyle = getRandomElement(hairstyles);

      const eyeColor = getRandomElement(eyeColors);

      const outfit = getRandomElement(outfits);


      const characterDiv = document.getElementById("character");

      characterDiv.innerHTML = `

        <div style="background-color: ${eyeColor}; height: 20px;"></div>

        <div style="background-image: url('${hairstyle}.png'); height: 100px;"></div>

        <div style="background-image: url('${outfit}.png'); height: 180px;"></div>

      `;

    }

  </script>

</body>

</html>



Generating anime characters using JavaScript involves creating a program that can randomly generate various attributes such as hairstyles, eye colors, clothing, and other features typical of anime characters. You can achieve this by creating a web page with HTML for the structure and CSS for styling, and then using JavaScript to handle the logic of character generation.


In this example, replace "hairstyle1.png", "hairstyle2.png", etc., and "outfit1.png", "outfit2.png", etc., with the actual file paths of your hairstyle and outfit images. You'll need to have image files for different hairstyles, eye colors, and outfits.

This is a basic example, and you can expand on it by adding more features, such as different facial expressions, accessories, and so on. You can also consider using a backend server to store a larger set of assets and dynamically load them into your character generator.

Have you ever wanted to be represented by an avatar in virtual reality? Are you looking to make a game or app that uses avatars in Javascript, Typescript, or PHP? Avatars are digital representations of people, pets, or entities. They're widely used in VR games and apps, and they're also becoming popular in the Metaverse—a unified digital space where people can meet, interact, and create things together. Avatar technology has been around for a long time—it's not new. But with the increasing popularity of the Metaverse, it is becoming more popular than ever. There are many different ways to use avatars. They can be used for all types of virtual experiences, including games and education apps. For example, you could create a game where you have to find your way through a maze using an avatar. Or, you could create an educational app where you have to find your way through a maze using an avatar. In the Metaverse and in VR gaming, avatars are more than just characters—they're extensions of ourselves. Many people jump into both the physical and virtual world wearing their best heels. Some gamers wear full-body suits to help them truly embody their avatars. Most avatars are animated by code—here are some popular open-source libraries you can use to create and use avatars.

Trending Discussions on Animation

AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire

Marquee Text Effect in Jetpack Compose

android:exported added but still getting error Apps targeting Android 12 and higher are required to specify an explicit value for android:exported

Error importing Framer Motion v5 in React (with create-react-app)

Android Build Error: &quot;lStar not found...&quot;

Make ModalBottomSheetLayout always Expanded

Project update recommended: Android Gradle Plugin can be upgraded. Error message: Can not find AGP version in build files

Angular TSLint - Cannot find builder &quot;@angular-devkit/build-angular:tslint&quot;

SVG stop running chained animation (&lt;animate&gt; tag)

How to replace deprecated .animation() in SwiftUI?

QUESTION

AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire

Asked 2022-Apr-01 at 12:56

I am trying to implement Firebase Realtime Database into a angular project and Im getting stuck at one of the very first steps. Importing AngularFireModule and AngularFireDatabaseModule. It gives me the following error:

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2
1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3

And here is how I am importing them:

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5

Am I missing something here? I have installed @angular/fire via the command

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6

and have also installed firebase tools. Here is a list of the Angular packages I currently have installed and their versions:

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26

I do apologise if this is all excessive information but I am completely stuck as to what the issue is. Any help would be GREATLY appreciated. Right now my suspicion is that its a compatibility issue or perhaps a feature that doesnt exist anymore on the latest versions but I really dont know.

ANSWER

Answered 2021-Aug-26 at 13:20

AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits.

Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions.

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26import { list } from '@angular/fire/database';
27

The initialization process is a bit different too as it has a more flexible API for specifying configurations.

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26import { list } from '@angular/fire/database';
27@NgModule({
28    imports: [
29        provideFirebaseApp(() =&gt; initializeApp(config)),
30        provideFirestore(() =&gt; {
31            const firestore = getFirestore();
32            connectEmulator(firestore, 'localhost', 8080);
33            enableIndexedDbPersistence(firestore);
34            return firestore;
35        }),
36        provideStorage(() =&gt; getStorage()),
37    ],
38})
39

If you want to proceed with the older API there's a compatibility layer.

1Module '&quot;@angular/fire&quot;' has no exported member 'AngularFireModule'.ts(2305)
2Module '&quot;@angular/fire/database&quot;' has no exported member 'AngularFireDatabaseModule'.
3import {AngularFireModule } from '@angular/fire';
4import {AngularFireDatabaseModule} from '@angular/fire/database'
5npm i firebase @angular/fire
6Angular CLI: 12.2.2
7Node: 14.17.4
8Package Manager: npm 6.14.14
9OS: win32 x64
10
11Angular: 12.2.3
12... animations, common, compiler, compiler-cli, core, forms
13... platform-browser, platform-browser-dynamic, router
14
15Package                         Version
16---------------------------------------------------------
17@angular-devkit/architect       0.1202.2
18@angular-devkit/build-angular   12.2.2
19@angular-devkit/core            12.2.2
20@angular-devkit/schematics      12.2.2
21@angular/cli                    12.2.2
22@angular/fire                   7.0.0
23@schematics/angular             12.2.2
24rxjs                            6.6.7
25typescript                      4.3.5
26import { list } from '@angular/fire/database';
27@NgModule({
28    imports: [
29        provideFirebaseApp(() =&gt; initializeApp(config)),
30        provideFirestore(() =&gt; {
31            const firestore = getFirestore();
32            connectEmulator(firestore, 'localhost', 8080);
33            enableIndexedDbPersistence(firestore);
34            return firestore;
35        }),
36        provideStorage(() =&gt; getStorage()),
37    ],
38})
39import { AngularFireModule} from '@angular/fire/compat'
40import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
41

Source https://stackoverflow.com/questions/68939014

QUESTION

Marquee Text Effect in Jetpack Compose

Asked 2022-Mar-30 at 10:05

In the past, a kind of animation could be included in the text, in which if the text exceeded the limits, it would automatically scroll horizontally. This was done by including: android:ellipsize="marquee", and the result was something similar to the one shown here:

enter image description here

The problem is that in Jetpack Compose I don't see a way to include that option inside the Composable Text, there is the TextOverflow that includes the Clip, Ellipsis or Visible options, but I don't know if there is a way to include or use the "Marquee" option in Jetpack Compose. Is there any way to do it?

ANSWER

Answered 2022-Mar-30 at 10:05

This is not yet supported by Compose, but it's not too hard to implement. You will need TargetBasedAnimation, which will update the text offset, and SubcomposeLayout, which lies under most collections. Inside you can define the size of the text, and also place the second similar Text, which will appear from the right edge.

1@Composable
2fun MarqueeText(
3    text: String,
4    modifier: Modifier = Modifier,
5    textModifier: Modifier = Modifier,
6    gradientEdgeColor: Color = Color.White,
7    color: Color = Color.Unspecified,
8    fontSize: TextUnit = TextUnit.Unspecified,
9    fontStyle: FontStyle? = null,
10    fontWeight: FontWeight? = null,
11    fontFamily: FontFamily? = null,
12    letterSpacing: TextUnit = TextUnit.Unspecified,
13    textDecoration: TextDecoration? = null,
14    textAlign: TextAlign? = null,
15    lineHeight: TextUnit = TextUnit.Unspecified,
16    overflow: TextOverflow = TextOverflow.Clip,
17    softWrap: Boolean = true,
18    onTextLayout: (TextLayoutResult) -&gt; Unit = {},
19    style: TextStyle = LocalTextStyle.current,
20) {
21    val createText = @Composable { localModifier: Modifier -&gt;
22        Text(
23            text,
24            textAlign = textAlign,
25            modifier = localModifier,
26            color = color,
27            fontSize = fontSize,
28            fontStyle = fontStyle,
29            fontWeight = fontWeight,
30            fontFamily = fontFamily,
31            letterSpacing = letterSpacing,
32            textDecoration = textDecoration,
33            lineHeight = lineHeight,
34            overflow = overflow,
35            softWrap = softWrap,
36            maxLines = 1,
37            onTextLayout = onTextLayout,
38            style = style,
39        )
40    }
41    var offset by remember { mutableStateOf(0) }
42    val textLayoutInfoState = remember { mutableStateOf&lt;TextLayoutInfo?&gt;(null) }
43    LaunchedEffect(textLayoutInfoState.value) {
44        val textLayoutInfo = textLayoutInfoState.value ?: return@LaunchedEffect
45        if (textLayoutInfo.textWidth &lt;= textLayoutInfo.containerWidth) return@LaunchedEffect
46        val duration = 7500 * textLayoutInfo.textWidth / textLayoutInfo.containerWidth
47        val delay = 1000L
48
49        do {
50            val animation = TargetBasedAnimation(
51                animationSpec = infiniteRepeatable(
52                    animation = tween(
53                        durationMillis = duration,
54                        delayMillis = 1000,
55                        easing = LinearEasing,
56                    ),
57                    repeatMode = RepeatMode.Restart
58                ),
59                typeConverter = Int.VectorConverter,
60                initialValue = 0,
61                targetValue = -textLayoutInfo.textWidth
62            )
63            val startTime = withFrameNanos { it }
64            do {
65                val playTime = withFrameNanos { it } - startTime
66                offset = (animation.getValueFromNanos(playTime))
67            } while (!animation.isFinishedFromNanos(playTime))
68            delay(delay)
69        } while (true)
70    }
71
72    SubcomposeLayout(
73        modifier = modifier.clipToBounds()
74    ) { constraints -&gt;
75        val infiniteWidthConstraints = constraints.copy(maxWidth = Int.MAX_VALUE)
76        var mainText = subcompose(MarqueeLayers.MainText) {
77            createText(textModifier)
78        }.first().measure(infiniteWidthConstraints)
79
80        var gradient: Placeable? = null
81
82        var secondPlaceableWithOffset: Pair&lt;Placeable, Int&gt;? = null
83        if (mainText.width &lt;= constraints.maxWidth) {
84            mainText = subcompose(MarqueeLayers.SecondaryText) {
85                createText(textModifier.fillMaxWidth())
86            }.first().measure(constraints)
87            textLayoutInfoState.value = null
88        } else {
89            val spacing = constraints.maxWidth * 2 / 3
90            textLayoutInfoState.value = TextLayoutInfo(
91                textWidth = mainText.width + spacing,
92                containerWidth = constraints.maxWidth
93            )
94            val secondTextOffset = mainText.width + offset + spacing
95            val secondTextSpace = constraints.maxWidth - secondTextOffset
96            if (secondTextSpace &gt; 0) {
97                secondPlaceableWithOffset = subcompose(MarqueeLayers.SecondaryText) {
98                    createText(textModifier)
99                }.first().measure(infiniteWidthConstraints) to secondTextOffset
100            }
101            gradient = subcompose(MarqueeLayers.EdgesGradient) {
102                Row {
103                    GradientEdge(gradientEdgeColor, Color.Transparent)
104                    Spacer(Modifier.weight(1f))
105                    GradientEdge(Color.Transparent, gradientEdgeColor)
106                }
107            }.first().measure(constraints.copy(maxHeight = mainText.height))
108        }
109
110        layout(
111            width = constraints.maxWidth,
112            height = mainText.height
113        ) {
114            mainText.place(offset, 0)
115            secondPlaceableWithOffset?.let {
116                it.first.place(it.second, 0)
117            }
118            gradient?.place(0, 0)
119        }
120    }
121}
122
123@Composable
124private fun GradientEdge(
125    startColor: Color, endColor: Color,
126) {
127    Box(
128        modifier = Modifier
129            .width(10.dp)
130            .fillMaxHeight()
131            .background(
132                brush = Brush.horizontalGradient(
133                    0f to startColor, 1f to endColor,
134                )
135            )
136    )
137}
138
139private enum class MarqueeLayers { MainText, SecondaryText, EdgesGradient }
140private data class TextLayoutInfo(val textWidth: Int, val containerWidth: Int)
141

Usage:

1@Composable
2fun MarqueeText(
3    text: String,
4    modifier: Modifier = Modifier,
5    textModifier: Modifier = Modifier,
6    gradientEdgeColor: Color = Color.White,
7    color: Color = Color.Unspecified,
8    fontSize: TextUnit = TextUnit.Unspecified,
9    fontStyle: FontStyle? = null,
10    fontWeight: FontWeight? = null,
11    fontFamily: FontFamily? = null,
12    letterSpacing: TextUnit = TextUnit.Unspecified,
13    textDecoration: TextDecoration? = null,
14    textAlign: TextAlign? = null,
15    lineHeight: TextUnit = TextUnit.Unspecified,
16    overflow: TextOverflow = TextOverflow.Clip,
17    softWrap: Boolean = true,
18    onTextLayout: (TextLayoutResult) -&gt; Unit = {},
19    style: TextStyle = LocalTextStyle.current,
20) {
21    val createText = @Composable { localModifier: Modifier -&gt;
22        Text(
23            text,
24            textAlign = textAlign,
25            modifier = localModifier,
26            color = color,
27            fontSize = fontSize,
28            fontStyle = fontStyle,
29            fontWeight = fontWeight,
30            fontFamily = fontFamily,
31            letterSpacing = letterSpacing,
32            textDecoration = textDecoration,
33            lineHeight = lineHeight,
34            overflow = overflow,
35            softWrap = softWrap,
36            maxLines = 1,
37            onTextLayout = onTextLayout,
38            style = style,
39        )
40    }
41    var offset by remember { mutableStateOf(0) }
42    val textLayoutInfoState = remember { mutableStateOf&lt;TextLayoutInfo?&gt;(null) }
43    LaunchedEffect(textLayoutInfoState.value) {
44        val textLayoutInfo = textLayoutInfoState.value ?: return@LaunchedEffect
45        if (textLayoutInfo.textWidth &lt;= textLayoutInfo.containerWidth) return@LaunchedEffect
46        val duration = 7500 * textLayoutInfo.textWidth / textLayoutInfo.containerWidth
47        val delay = 1000L
48
49        do {
50            val animation = TargetBasedAnimation(
51                animationSpec = infiniteRepeatable(
52                    animation = tween(
53                        durationMillis = duration,
54                        delayMillis = 1000,
55                        easing = LinearEasing,
56                    ),
57                    repeatMode = RepeatMode.Restart
58                ),
59                typeConverter = Int.VectorConverter,
60                initialValue = 0,
61                targetValue = -textLayoutInfo.textWidth
62            )
63            val startTime = withFrameNanos { it }
64            do {
65                val playTime = withFrameNanos { it } - startTime
66                offset = (animation.getValueFromNanos(playTime))
67            } while (!animation.isFinishedFromNanos(playTime))
68            delay(delay)
69        } while (true)
70    }
71
72    SubcomposeLayout(
73        modifier = modifier.clipToBounds()
74    ) { constraints -&gt;
75        val infiniteWidthConstraints = constraints.copy(maxWidth = Int.MAX_VALUE)
76        var mainText = subcompose(MarqueeLayers.MainText) {
77            createText(textModifier)
78        }.first().measure(infiniteWidthConstraints)
79
80        var gradient: Placeable? = null
81
82        var secondPlaceableWithOffset: Pair&lt;Placeable, Int&gt;? = null
83        if (mainText.width &lt;= constraints.maxWidth) {
84            mainText = subcompose(MarqueeLayers.SecondaryText) {
85                createText(textModifier.fillMaxWidth())
86            }.first().measure(constraints)
87            textLayoutInfoState.value = null
88        } else {
89            val spacing = constraints.maxWidth * 2 / 3
90            textLayoutInfoState.value = TextLayoutInfo(
91                textWidth = mainText.width + spacing,
92                containerWidth = constraints.maxWidth
93            )
94            val secondTextOffset = mainText.width + offset + spacing
95            val secondTextSpace = constraints.maxWidth - secondTextOffset
96            if (secondTextSpace &gt; 0) {
97                secondPlaceableWithOffset = subcompose(MarqueeLayers.SecondaryText) {
98                    createText(textModifier)
99                }.first().measure(infiniteWidthConstraints) to secondTextOffset
100            }
101            gradient = subcompose(MarqueeLayers.EdgesGradient) {
102                Row {
103                    GradientEdge(gradientEdgeColor, Color.Transparent)
104                    Spacer(Modifier.weight(1f))
105                    GradientEdge(Color.Transparent, gradientEdgeColor)
106                }
107            }.first().measure(constraints.copy(maxHeight = mainText.height))
108        }
109
110        layout(
111            width = constraints.maxWidth,
112            height = mainText.height
113        ) {
114            mainText.place(offset, 0)
115            secondPlaceableWithOffset?.let {
116                it.first.place(it.second, 0)
117            }
118            gradient?.place(0, 0)
119        }
120    }
121}
122
123@Composable
124private fun GradientEdge(
125    startColor: Color, endColor: Color,
126) {
127    Box(
128        modifier = Modifier
129            .width(10.dp)
130            .fillMaxHeight()
131            .background(
132                brush = Brush.horizontalGradient(
133                    0f to startColor, 1f to endColor,
134                )
135            )
136    )
137}
138
139private enum class MarqueeLayers { MainText, SecondaryText, EdgesGradient }
140private data class TextLayoutInfo(val textWidth: Int, val containerWidth: Int)
141MarqueeText(&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt&quot;)
142

Result:

Source https://stackoverflow.com/questions/68974245

QUESTION

android:exported added but still getting error Apps targeting Android 12 and higher are required to specify an explicit value for android:exported

Asked 2022-Mar-24 at 15:30

I have added android:exported="true" to my only activity in manifest but still getting below error after updating compile sdk and target sdk version to 31.I also tried rebuilding the project , invalidating cache and restart but that didn't helped

Error- Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

AndroidManifest File
1&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
2&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
3    package=&quot;com.xyz.abc&quot;&gt;
4
5    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
6    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
7
8    &lt;application
9        android:name=&quot;.framework.presentation.BaseApplication&quot;
10        android:allowBackup=&quot;true&quot;
11        android:icon=&quot;@mipmap/ic_launcher&quot;
12        android:label=&quot;@string/app_name&quot;
13        android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
14        android:supportsRtl=&quot;true&quot;
15        android:theme=&quot;@style/AppTheme&quot;&gt;
16        &lt;activity android:name=&quot;com.xyz.presentation.MainActivity&quot;
17            android:exported=&quot;true&quot;&gt;
18            &lt;intent-filter&gt;
19                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
20
21                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
22            &lt;/intent-filter&gt;
23        &lt;/activity&gt;
24    &lt;/application&gt;
25
26&lt;/manifest&gt;
27
Merged manifest error

Other Manifest Files (Included in merge, but did not contribute any elements) firebase-installations:17.0.0 manifest, versionedparcelable:1.1.1 manifest, runtime:1.0.1 manifest, test:core:1.2.0 manifest, loader:1.0.0 manifest, facebook-share:11.1.0 manifest, leakcanary:leaksentry:2.0-alpha-3 manifest, material-dialogs:input:3.2.1 manifest, material-icons-extended:1.0.0 manifest, play-services-stats:17.0.0 manifest, interpolator:1.0.0 manifest, activity-compose:1.3.1 manifest, material-ripple:1.0.0 manifest, foundation:1.0.0 manifest, asynclayoutinflater:1.0.0 manifest, savedstate-ktx:1.1.0 manifest, navigation-dynamic-features-fragment:2.3.5 manifest, firebase-ui-auth:7.2.0 manifest, animation:1.0.1 manifest, animation-core:1.0.1 manifest, installreferrer:1.0 manifest, firebase-crashlytics:18.0.0 manifest, ui:1.0.1 manifest, lifecycle-viewmodel-savedstate:2.3.1 manifest, play-services-auth-base:17.0.0 manifest, hilt-android:2.35.1 manifest, material-dialogs:core:3.2.1 manifest, AndroidManifest.xml navigation file, savedstate:1.1.0 manifest, cursoradapter:1.0.0 manifest, sqlite-framework:2.0.1 manifest, room-ktx:2.1.0 manifest, leakcanary-android-core:2.0-alpha-3 manifest, AndroidManifest.xml navigation file, media:1.0.0 manifest, coordinatorlayout:1.1.0 manifest, legacy-support-core-utils:1.0.0 manifest, lifecycle-runtime:2.3.1 manifest, coil-kt:coil:1.3.1 manifest, ui-tooling-preview:1.0.0 manifest, facebook-core:11.1.0 manifest, core:1.6.0 manifest, material:1.0.0 manifest, firebase-common:20.0.0 manifest, documentfile:1.0.0 manifest, lifecycle-viewmodel-compose:2.4.0-beta01 manifest, play-services-base:17.1.0 manifest, ui-tooling-data:1.0.0 manifest, coil-base:1.3.1 manifest, firebase-analytics-ktx:19.0.0 manifest, localbroadcastmanager:1.0.0 manifest, swiperefreshlayout:1.1.0-alpha03 manifest, constraintlayout-compose:1.0.0-beta02 manifest, core-ktx:1.6.0 manifest, firebase-database-collection:18.0.0 manifest, coil-compose-base:1.3.1 manifest, activity:1.3.1 manifest, AndroidManifest.xml navigation file, facebook-messenger:11.1.0 manifest, print:1.0.0 manifest, customview:1.1.0 manifest, material-icons-core:1.0.0 manifest, play-services-measurement-sdk:19.0.0 manifest, fragment:1.3.4 manifest, firebase-appcheck-interop:16.0.0-beta01 manifest, facebook-login:11.1.0 manifest, cardview:1.0.0 manifest, runtime-rxjava2:1.0.0 manifest, viewpager2:1.0.0 manifest, play-services-ads-identifier:17.0.0 manifest, play-services-measurement-impl:19.0.0 manifest, lifecycle-livedata-core:2.3.1 manifest, play-services-safetynet:17.0.0 manifest, AndroidManifest.xml navigation file, lifecycle-viewmodel-ktx:2.3.1 manifest, transport-backend-cct:3.0.0 manifest, fragment-ktx:1.2.4 manifest, appcompat:1.3.0 manifest, transport-runtime:3.0.0 manifest, lifecycle-livedata-core-ktx:2.2.0 manifest, firebase-firestore-ktx:23.0.0 manifest, legacy-support-v4:1.0.0 manifest, play-services-basement:17.1.1 manifest, firebase-storage:20.0.0 manifest, play-services-auth-api-phone:17.4.0 manifest, leakcanary-android:2.0-alpha-3 manifest, firebase-auth-interop:20.0.0 manifest, lifecycle-viewmodel:2.3.1 manifest, browser:1.0.0 manifest, firebase-auth:21.0.1 manifest, material:1.2.1 manifest, slidingpanelayout:1.0.0 manifest, vectordrawable:1.1.0 manifest, recyclerview:1.1.0 manifest, play-services-auth:19.0.0 manifest, room-runtime:2.1.0 manifest, dagger-lint-aar:2.35.1 manifest, navigation-dynamic-features-runtime:2.3.5 manifest, play-services-measurement-api:19.0.0 manifest, firebase-encoders-json:18.0.0 manifest, sqlite:2.0.1 manifest, facebook-android-sdk:11.1.0 manifest, firebase-components:17.0.0 manifest, transport-api:3.0.0 manifest, protolite-well-known-types:18.0.0 manifest, markdown-processor:0.1.3 manifest, play-services-measurement-base:19.0.0 manifest, firebase-common-ktx:20.0.0 manifest, activity-ktx:1.3.1 manifest, firebase-crashlytics-ktx:18.0.0 manifest, coil-compose:1.3.1 manifest, multidex:2.0.1 manifest, core-runtime:2.1.0 manifest, fragment-testing:1.2.0 manifest, ui-graphics:1.0.1 manifest, AndroidManifest.xml navigation file, ui-tooling:1.0.0 manifest, grpc-android:1.28.0 manifest, ui-unit:1.0.1 manifest, play-services-measurement:19.0.0 manifest, play:core:1.9.1 manifest, annotation-experimental:1.1.0 manifest, play-services-measurement-sdk-api:19.0.0 manifest, play-services-tasks:17.0.0 manifest, firebase-analytics:19.0.0 manifest, facebook-common:11.1.0 manifest, drawerlayout:1.1.1 manifest, AndroidManifest.xml navigation file, navigation-compose:2.4.0-alpha09 manifest, facebook-gamingservices:11.1.0 manifest, firebase-firestore:23.0.0 manifest, lifecycle-livedata:2.2.0 manifest, legacy-support-core-ui:1.0.0 manifest, test:monitor:1.2.0 manifest, AndroidManifest.xml navigation file, facebook-applinks:11.1.0 manifest, viewpager:1.0.0 manifest, ui-geometry:1.0.1 manifest, lifecycle-runtime-ktx:2.3.1 manifest, constraintlayout:2.0.4 manifest, ui-text:1.0.1 manifest, AndroidManifest.xml navigation file, firebase-installations-interop:17.0.0 manifest, transition:1.3.0 manifest, foundation-layout:1.0.1 manifest, appcompat-resources:1.3.1 manifest, runtime-livedata:1.0.0 manifest, runtime-saveable:1.0.1 manifest, firebase-measurement-connector:19.0.0 manifest, vectordrawable-animated:1.1.0 manifest, main nav_graph.xml navigation file Merging Errors: Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Dairy.app main manifest (this file) Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Dairy.app main manifest (this file) Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Dairy.app main manifest (this file)

ANSWER

Answered 2021-Oct-05 at 10:38

After the build has failed go to AndroidManifest.xml and in the bottom click merged manifest see which activities which have intent-filter but don't have exported=true attribute. Or you can just get the activities which are giving error.

Add these activities to your App manifest with android:exported="true" and app tools:node="merge" this will add exported attribute to the activities giving error.

Example:

1&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
2&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
3    package=&quot;com.xyz.abc&quot;&gt;
4
5    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
6    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
7
8    &lt;application
9        android:name=&quot;.framework.presentation.BaseApplication&quot;
10        android:allowBackup=&quot;true&quot;
11        android:icon=&quot;@mipmap/ic_launcher&quot;
12        android:label=&quot;@string/app_name&quot;
13        android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
14        android:supportsRtl=&quot;true&quot;
15        android:theme=&quot;@style/AppTheme&quot;&gt;
16        &lt;activity android:name=&quot;com.xyz.presentation.MainActivity&quot;
17            android:exported=&quot;true&quot;&gt;
18            &lt;intent-filter&gt;
19                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
20
21                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
22            &lt;/intent-filter&gt;
23        &lt;/activity&gt;
24    &lt;/application&gt;
25
26&lt;/manifest&gt;
27      &lt;activity
28            android:name=&quot;&lt;activity which is giving error&gt;&quot;
29            android:exported=&quot;true&quot;
30            tools:node=&quot;merge&quot; /&gt;
31

You will have to do this once, you can remove this once the library developers update their libs.

Source https://stackoverflow.com/questions/69287478

QUESTION

Error importing Framer Motion v5 in React (with create-react-app)

Asked 2022-Mar-13 at 15:19

When am trying to do simple animation for div using framer motion. Am getting this following error in browser

/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs

1Can't import the named export 'Children' from non EcmaScript module (only default export is available)```
2

ANSWER

Answered 2021-Nov-01 at 16:16

Here's the response to the issue from the Framer Discord

regarding the issue with the current version of create-react-app (CRA) the issue is being tracked on GitHub here: https://github.com/formatjs/formatjs/issues/1395

After testing a bit it seems that the issue is with how CRA handles ESM dependancies and more particularly transitive dependancies are not handled correctly it seems. There is also an outstanding issue with CRA about this https://github.com/facebook/create-react-app/issues/10356.

Options:

  1. This is fixed/doesn't break in the next version of CRA which you can try today (https://github.com/facebook/create-react-app/discussions/11278) take note though its still in alpha.

  2. You can patch CRA to get around the issue as described in a number of tickets from other libraries

Source https://stackoverflow.com/questions/69769360

QUESTION

Android Build Error: &quot;lStar not found...&quot;

Asked 2022-Feb-18 at 06:59

I have error like this after trying to build my apps in Emulator

/Users/joel/.gradle/caches/transforms-3/06231cc1265260b25a06bafce7a4176f/transformed/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

I don't know what causes this error. After digging some answer which has similarly error (but in flutter) Problem. But still not solved my issue.

I have this dependency in my project

1buildscript {
2    repositories {
3        google()
4        maven { url 'https://plugins.gradle.org/m2/' }
5    }
6
7    dependencies {
8        classpath 'com.google.gms:google-services:4.3.3'
9        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
10    }
11}
12apply plugin: 'com.android.application'
13apply plugin: 'com.google.gms.google-services'
14apply plugin: 'kotlin-android'
15apply plugin: 'kotlin-android-extensions'
16apply plugin: 'kotlin-kapt'
17apply plugin: 'com.google.firebase.crashlytics'
18
19repositories {
20    maven { url 'https://maven.fabric.io/public' }
21    maven { url 'https://maven.google.com' }
22    maven { url  &quot;https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod&quot;}
23    mavenCentral()
24
25}
26
27android {
28    compileSdkVersion 29
29    buildToolsVersion '28.0.3'
30    defaultConfig {
31        applicationId &quot;mobile.apps.my&quot;
32        minSdkVersion 17
33        targetSdkVersion 29
34        multiDexEnabled true
35        versionCode 152
36        versionName &quot;8.1.7&quot;
37        vectorDrawables.useSupportLibrary = true // This line hereP
38        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
39    }
40
41    compileOptions {
42        sourceCompatibility JavaVersion.VERSION_1_8
43        targetCompatibility JavaVersion.VERSION_1_8
44    }
45
46    dataBinding {
47        enabled = true
48    }
49
50    buildTypes {
51        debug {
52            firebaseCrashlytics {
53                mappingFileUploadEnabled false
54            }
55        }
56
57        release {
58            minifyEnabled true
59            shrinkResources true
60            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
61        }
62    }
63
64    lintOptions {
65        checkReleaseBuilds false
66        abortOnError false
67    }
68}
69
70dependencies {
71
72    implementation fileTree(include: ['*.jar'], dir: 'libs')
73    androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0-beta01', {
74        exclude group: 'com.android.support', module: 'support-annotations'
75    })
76    //noinspection GradleCompatible
77    implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
78    implementation &quot;androidx.appcompat:appcompat-resources:1.4.0-alpha03&quot;
79
80    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
81    implementation 'androidx.preference:preference:1.1.1'
82    implementation 'com.google.android.material:material:1.4.0'
83    implementation 'androidx.recyclerview:recyclerview:1.2.1'
84    implementation 'androidx.cardview:cardview:1.0.0'
85    implementation 'androidx.percentlayout:percentlayout:1.0.0'
86
87    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
88    implementation 'it.sephiroth.android.library.imagezoom:imagezoom:2.3.0'
89    testImplementation 'org.json:json:20140107'
90    implementation 'com.comscore:android-analytics:6.1.0'
91    implementation 'com.android.support:customtabs:29.0.0'
92    implementation 'androidx.viewpager2:viewpager2:1.0.0'
93    implementation 'com.android.support:customtabs:29.0.0'
94
95    // Kodein Dependency Injection
96    implementation 'org.kodein.di:kodein-di-generic-jvm:6.2.1'
97    implementation 'org.kodein.di:kodein-di-framework-android-x:6.2.1'
98
99    // RETROFIT
100    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
101    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
102    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
103    implementation 'com.google.code.gson:gson:2.8.5'
104    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' // for test String
105
106
107    // Room components
108    implementation &quot;androidx.room:room-runtime:2.2.5&quot;
109    kapt &quot;androidx.room:room-compiler:2.2.5&quot;
110    implementation &quot;androidx.room:room-ktx:2.2.5&quot;
111    androidTestImplementation &quot;androidx.room:room-testing:2.2.5&quot;
112
113    // Lifecycle components
114    implementation 'android.arch.lifecycle:extensions:1.1.1'
115    implementation 'androidx.paging:paging-runtime:2.1.2'
116
117    // UI
118    implementation 'com.squareup.picasso:picasso:2.71828'
119    implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
120    implementation 'com.github.bluzwong:swipeback:0.2.0@aar'
121    implementation 'com.airbnb.android:lottie:3.6.0'
122
123    implementation 'com.veinhorn.scrollgalleryview:library:1.2.6'
124    implementation 'com.veinhorn.scrollgalleryview:picasso-loader:1.2.4'
125    implementation 'com.github.rubensousa:bottomsheetbuilder:1.6.1'
126    implementation &quot;com.andkulikov:transitionseverywhere:1.8.1&quot;
127
128
129    // HTTP LOGGING
130    implementation 'com.jakewharton.timber:timber:4.7.1'
131    implementation 'org.jsoup:jsoup:1.13.1'
132    implementation 'androidx.multidex:multidex:2.0.1'
133
134
135    // ADS
136    implementation 'com.android.support:support-annotations:28.0.0'
137    // Required Dependency by Audience Network SDK
138    implementation 'com.google.android.gms:play-services-ads:19.7.0'
139    implementation 'com.google.android.gms:play-services-basement:17.6.0'
140    implementation(&quot;tv.teads.sdk.android:sdk:4.7.2@aar&quot;) {
141        transitive = true
142    }
143    implementation 'com.criteo.publisher:criteo-publisher-sdk:4.0.0'
144    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
145    implementation 'com.google.android.gms:play-services-base:17.6.0'
146
147    implementation ('com.facebook.android:audience-network-sdk:5.5.0'){
148        exclude group: 'com.google.android.gms'
149    }
150
151    implementation 'com.google.firebase:firebase-crashlytics:17.4.0'
152
153    implementation &quot;androidx.core:core-ktx:1.6.0&quot;  // I have update this based on other solution
154    implementation &quot;androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1&quot;
155    implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
156
157    // COROUTINES
158    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
159    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
160    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
161
162    // Kotlin + coroutines
163    implementation &quot;androidx.work:work-runtime-ktx:2.5.0&quot;
164
165    implementation 'com.github.mumayank:AirLocation:1.3.1'
166    androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
167
168    implementation 'com.android.installreferrer:installreferrer:2.2'
169
170    //ANIMATION
171    implementation 'com.daimajia.androidanimations:library:2.4@aar'
172    implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'
173    implementation 'com.romandanylyk:pageindicatorview:1.0.3'
174
175    implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
176
177    //SOCIAL
178    implementation 'com.google.android.gms:play-services-auth:19.0.0'
179
180}
181

I have tried to upgrade version of androidx.core:core-ktx:1.6.0 then sync or invalidate cache/restart. But none of them give me good result. I am sure yesterday my project was alright with same dependency. Someone please help me, if this question unclear let me add more information. Thanks

ANSWER

Answered 2021-Sep-28 at 17:18

I managed to fix this by upgrading compileSdk to 31 and kotlin gradle plugin to 1.5.10

1buildscript {
2    repositories {
3        google()
4        maven { url 'https://plugins.gradle.org/m2/' }
5    }
6
7    dependencies {
8        classpath 'com.google.gms:google-services:4.3.3'
9        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
10    }
11}
12apply plugin: 'com.android.application'
13apply plugin: 'com.google.gms.google-services'
14apply plugin: 'kotlin-android'
15apply plugin: 'kotlin-android-extensions'
16apply plugin: 'kotlin-kapt'
17apply plugin: 'com.google.firebase.crashlytics'
18
19repositories {
20    maven { url 'https://maven.fabric.io/public' }
21    maven { url 'https://maven.google.com' }
22    maven { url  &quot;https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod&quot;}
23    mavenCentral()
24
25}
26
27android {
28    compileSdkVersion 29
29    buildToolsVersion '28.0.3'
30    defaultConfig {
31        applicationId &quot;mobile.apps.my&quot;
32        minSdkVersion 17
33        targetSdkVersion 29
34        multiDexEnabled true
35        versionCode 152
36        versionName &quot;8.1.7&quot;
37        vectorDrawables.useSupportLibrary = true // This line hereP
38        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
39    }
40
41    compileOptions {
42        sourceCompatibility JavaVersion.VERSION_1_8
43        targetCompatibility JavaVersion.VERSION_1_8
44    }
45
46    dataBinding {
47        enabled = true
48    }
49
50    buildTypes {
51        debug {
52            firebaseCrashlytics {
53                mappingFileUploadEnabled false
54            }
55        }
56
57        release {
58            minifyEnabled true
59            shrinkResources true
60            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
61        }
62    }
63
64    lintOptions {
65        checkReleaseBuilds false
66        abortOnError false
67    }
68}
69
70dependencies {
71
72    implementation fileTree(include: ['*.jar'], dir: 'libs')
73    androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0-beta01', {
74        exclude group: 'com.android.support', module: 'support-annotations'
75    })
76    //noinspection GradleCompatible
77    implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
78    implementation &quot;androidx.appcompat:appcompat-resources:1.4.0-alpha03&quot;
79
80    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
81    implementation 'androidx.preference:preference:1.1.1'
82    implementation 'com.google.android.material:material:1.4.0'
83    implementation 'androidx.recyclerview:recyclerview:1.2.1'
84    implementation 'androidx.cardview:cardview:1.0.0'
85    implementation 'androidx.percentlayout:percentlayout:1.0.0'
86
87    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
88    implementation 'it.sephiroth.android.library.imagezoom:imagezoom:2.3.0'
89    testImplementation 'org.json:json:20140107'
90    implementation 'com.comscore:android-analytics:6.1.0'
91    implementation 'com.android.support:customtabs:29.0.0'
92    implementation 'androidx.viewpager2:viewpager2:1.0.0'
93    implementation 'com.android.support:customtabs:29.0.0'
94
95    // Kodein Dependency Injection
96    implementation 'org.kodein.di:kodein-di-generic-jvm:6.2.1'
97    implementation 'org.kodein.di:kodein-di-framework-android-x:6.2.1'
98
99    // RETROFIT
100    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
101    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
102    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
103    implementation 'com.google.code.gson:gson:2.8.5'
104    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' // for test String
105
106
107    // Room components
108    implementation &quot;androidx.room:room-runtime:2.2.5&quot;
109    kapt &quot;androidx.room:room-compiler:2.2.5&quot;
110    implementation &quot;androidx.room:room-ktx:2.2.5&quot;
111    androidTestImplementation &quot;androidx.room:room-testing:2.2.5&quot;
112
113    // Lifecycle components
114    implementation 'android.arch.lifecycle:extensions:1.1.1'
115    implementation 'androidx.paging:paging-runtime:2.1.2'
116
117    // UI
118    implementation 'com.squareup.picasso:picasso:2.71828'
119    implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
120    implementation 'com.github.bluzwong:swipeback:0.2.0@aar'
121    implementation 'com.airbnb.android:lottie:3.6.0'
122
123    implementation 'com.veinhorn.scrollgalleryview:library:1.2.6'
124    implementation 'com.veinhorn.scrollgalleryview:picasso-loader:1.2.4'
125    implementation 'com.github.rubensousa:bottomsheetbuilder:1.6.1'
126    implementation &quot;com.andkulikov:transitionseverywhere:1.8.1&quot;
127
128
129    // HTTP LOGGING
130    implementation 'com.jakewharton.timber:timber:4.7.1'
131    implementation 'org.jsoup:jsoup:1.13.1'
132    implementation 'androidx.multidex:multidex:2.0.1'
133
134
135    // ADS
136    implementation 'com.android.support:support-annotations:28.0.0'
137    // Required Dependency by Audience Network SDK
138    implementation 'com.google.android.gms:play-services-ads:19.7.0'
139    implementation 'com.google.android.gms:play-services-basement:17.6.0'
140    implementation(&quot;tv.teads.sdk.android:sdk:4.7.2@aar&quot;) {
141        transitive = true
142    }
143    implementation 'com.criteo.publisher:criteo-publisher-sdk:4.0.0'
144    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
145    implementation 'com.google.android.gms:play-services-base:17.6.0'
146
147    implementation ('com.facebook.android:audience-network-sdk:5.5.0'){
148        exclude group: 'com.google.android.gms'
149    }
150
151    implementation 'com.google.firebase:firebase-crashlytics:17.4.0'
152
153    implementation &quot;androidx.core:core-ktx:1.6.0&quot;  // I have update this based on other solution
154    implementation &quot;androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1&quot;
155    implementation &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
156
157    // COROUTINES
158    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
159    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
160    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
161
162    // Kotlin + coroutines
163    implementation &quot;androidx.work:work-runtime-ktx:2.5.0&quot;
164
165    implementation 'com.github.mumayank:AirLocation:1.3.1'
166    androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
167
168    implementation 'com.android.installreferrer:installreferrer:2.2'
169
170    //ANIMATION
171    implementation 'com.daimajia.androidanimations:library:2.4@aar'
172    implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'
173    implementation 'com.romandanylyk:pageindicatorview:1.0.3'
174
175    implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
176
177    //SOCIAL
178    implementation 'com.google.android.gms:play-services-auth:19.0.0'
179
180}
181compileSdk = 31
182
183classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10'
184

Source https://stackoverflow.com/questions/69041630

QUESTION

Make ModalBottomSheetLayout always Expanded

Asked 2022-Feb-09 at 10:50

I am using ModalBottomSheetLayout in Jetpack Compose. Whenever it is shown with modalBottomSheetState.show(), it shows HalfExpanded or Expanded depending on the height of its content. This is from the source code:

1val anchors = if (sheetHeight &lt; fullHeight / 2) {
2        mapOf(
3            fullHeight to Hidden,
4            fullHeight - sheetHeight to Expanded
5        )
6    } else {
7        mapOf(
8            fullHeight to Hidden,
9            fullHeight / 2 to HalfExpanded,
10            max(0f, fullHeight - sheetHeight) to Expanded
11        )
12    }
13    Modifier.swipeable(
14        state = sheetState,
15        anchors = anchors,
16        orientation = Orientation.Vertical,
17        enabled = sheetState.currentValue != Hidden,
18        resistance = null
19    )
20

Then show() works like here:

1val anchors = if (sheetHeight &lt; fullHeight / 2) {
2        mapOf(
3            fullHeight to Hidden,
4            fullHeight - sheetHeight to Expanded
5        )
6    } else {
7        mapOf(
8            fullHeight to Hidden,
9            fullHeight / 2 to HalfExpanded,
10            max(0f, fullHeight - sheetHeight) to Expanded
11        )
12    }
13    Modifier.swipeable(
14        state = sheetState,
15        anchors = anchors,
16        orientation = Orientation.Vertical,
17        enabled = sheetState.currentValue != Hidden,
18        resistance = null
19    )
20 internal val isHalfExpandedEnabled: Boolean
21    get() = anchors.values.contains(HalfExpanded)
22
23/**
24 * Show the bottom sheet with animation and suspend until it's shown. If half expand is
25 * enabled, the bottom sheet will be half expanded. Otherwise it will be fully expanded.
26 *
27 * @throws [CancellationException] if the animation is interrupted
28 */
29suspend fun show() {
30    val targetValue =
31        if (isHalfExpandedEnabled) HalfExpanded
32        else Expanded
33    animateTo(targetValue = targetValue)
34}
35

I wonder if we can set it to always Expanded somehow

ANSWER

Answered 2021-Aug-23 at 09:56

You can use:

1val anchors = if (sheetHeight &lt; fullHeight / 2) {
2        mapOf(
3            fullHeight to Hidden,
4            fullHeight - sheetHeight to Expanded
5        )
6    } else {
7        mapOf(
8            fullHeight to Hidden,
9            fullHeight / 2 to HalfExpanded,
10            max(0f, fullHeight - sheetHeight) to Expanded
11        )
12    }
13    Modifier.swipeable(
14        state = sheetState,
15        anchors = anchors,
16        orientation = Orientation.Vertical,
17        enabled = sheetState.currentValue != Hidden,
18        resistance = null
19    )
20 internal val isHalfExpandedEnabled: Boolean
21    get() = anchors.values.contains(HalfExpanded)
22
23/**
24 * Show the bottom sheet with animation and suspend until it's shown. If half expand is
25 * enabled, the bottom sheet will be half expanded. Otherwise it will be fully expanded.
26 *
27 * @throws [CancellationException] if the animation is interrupted
28 */
29suspend fun show() {
30    val targetValue =
31        if (isHalfExpandedEnabled) HalfExpanded
32        else Expanded
33    animateTo(targetValue = targetValue)
34}
35scope.launch { state.animateTo(ModalBottomSheetValue.Expanded) }
36

instead of

1val anchors = if (sheetHeight &lt; fullHeight / 2) {
2        mapOf(
3            fullHeight to Hidden,
4            fullHeight - sheetHeight to Expanded
5        )
6    } else {
7        mapOf(
8            fullHeight to Hidden,
9            fullHeight / 2 to HalfExpanded,
10            max(0f, fullHeight - sheetHeight) to Expanded
11        )
12    }
13    Modifier.swipeable(
14        state = sheetState,
15        anchors = anchors,
16        orientation = Orientation.Vertical,
17        enabled = sheetState.currentValue != Hidden,
18        resistance = null
19    )
20 internal val isHalfExpandedEnabled: Boolean
21    get() = anchors.values.contains(HalfExpanded)
22
23/**
24 * Show the bottom sheet with animation and suspend until it's shown. If half expand is
25 * enabled, the bottom sheet will be half expanded. Otherwise it will be fully expanded.
26 *
27 * @throws [CancellationException] if the animation is interrupted
28 */
29suspend fun show() {
30    val targetValue =
31        if (isHalfExpandedEnabled) HalfExpanded
32        else Expanded
33    animateTo(targetValue = targetValue)
34}
35scope.launch { state.animateTo(ModalBottomSheetValue.Expanded) }
36scope.launch { state.show() }
37

Source https://stackoverflow.com/questions/68890357

QUESTION

Project update recommended: Android Gradle Plugin can be upgraded. Error message: Can not find AGP version in build files

Asked 2022-Feb-06 at 03:17

After a recommendation in Android Studio to upgrade Android Gradle Plugin from 7.0.0 to 7.0.2 the Upgrade Assistant notifies that Cannot find AGP version in build files, and therefore I am not able to do the upgrade.

What shall I do?

Thanks

Code at build.gradle (project)

1buildscript {
2    repositories {
3        google()
4    }
5    dependencies {
6        classpath Libs.androidGradlePlugin
7        classpath Libs.Kotlin.gradlePlugin
8        classpath Libs.Hilt.gradlePlugin
9    }
10}
11
12plugins {
13    id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17    repositories {
18        google()
19        mavenCentral()
20
21        if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22            maven { url Urls.composeSnapshotRepo }
23        }
24
25        if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26            maven { url Urls.mavenCentralSnapshotRepo }
27        }
28    }
29
30    apply plugin: 'com.diffplug.spotless'
31    spotless {
32        kotlin {
33            target '**/*.kt'
34            targetExclude(&quot;$buildDir/**/*.kt&quot;)
35            targetExclude('bin/**/*.kt')
36            ktlint(Versions.ktLint)
37            licenseHeaderFile rootProject.file('spotless/copyright.kt')
38        }
39    }
40
41    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42        kotlinOptions {
43            jvmTarget = &quot;1.8&quot;
44
45            // Use experimental APIs
46            freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47        }
48    }
49    // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50    configurations.configureEach {
51        resolutionStrategy {
52            force Libs.JUnit.junit
53        }
54    }
55}
56
57

Code at build.gradle (module)

1buildscript {
2    repositories {
3        google()
4    }
5    dependencies {
6        classpath Libs.androidGradlePlugin
7        classpath Libs.Kotlin.gradlePlugin
8        classpath Libs.Hilt.gradlePlugin
9    }
10}
11
12plugins {
13    id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17    repositories {
18        google()
19        mavenCentral()
20
21        if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22            maven { url Urls.composeSnapshotRepo }
23        }
24
25        if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26            maven { url Urls.mavenCentralSnapshotRepo }
27        }
28    }
29
30    apply plugin: 'com.diffplug.spotless'
31    spotless {
32        kotlin {
33            target '**/*.kt'
34            targetExclude(&quot;$buildDir/**/*.kt&quot;)
35            targetExclude('bin/**/*.kt')
36            ktlint(Versions.ktLint)
37            licenseHeaderFile rootProject.file('spotless/copyright.kt')
38        }
39    }
40
41    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42        kotlinOptions {
43            jvmTarget = &quot;1.8&quot;
44
45            // Use experimental APIs
46            freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47        }
48    }
49    // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50    configurations.configureEach {
51        resolutionStrategy {
52            force Libs.JUnit.junit
53        }
54    }
55}
56
57plugins {
58    id 'com.android.application'
59    id 'kotlin-android'
60    id 'kotlin-kapt'
61    id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file(&quot;local.properties&quot;).exists()) {
67    properties.load(rootProject.file(&quot;local.properties&quot;).newDataInputStream())
68}
69
70android {
71    compileSdkVersion 31
72    defaultConfig {
73        applicationId &quot;androidx.compose.samples.crane&quot;
74        minSdkVersion 21
75        targetSdkVersion 31
76        versionCode 1
77        versionName &quot;1.0&quot;
78        vectorDrawables.useSupportLibrary = true
79        testInstrumentationRunner &quot;androidx.compose.samples.crane.CustomTestRunner&quot;
80
81        manifestPlaceholders = [ googleMapsKey : properties.getProperty(&quot;google.maps.key&quot;, &quot;&quot;) ]
82    }
83
84    signingConfigs {
85        // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86        // Cert fingerprint = 
87        debug {
88            storeFile rootProject.file('debug.keystore')
89            storePassword 'xxxxxxxxxx'
90            keyAlias 'xxxxxxxxxxx'
91            keyPassword 'xxxxxxxxxx'
92        }
93    }
94
95    buildTypes {
96        debug {
97            signingConfig signingConfigs.debug
98        }
99
100        release {
101            minifyEnabled true
102            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103        }
104    }
105
106    compileOptions {
107        sourceCompatibility JavaVersion.VERSION_1_8
108        targetCompatibility JavaVersion.VERSION_1_8
109    }
110
111    kotlinOptions {
112        jvmTarget = &quot;1.8&quot;
113    }
114
115    buildFeatures {
116         compose true
117
118        // Disable unused AGP features
119        buildConfig false
120        aidl false
121        renderScript false
122        resValues false
123        shaders false
124    }
125
126    composeOptions {
127        kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128    }
129
130    packagingOptions {
131        // Multiple dependency bring these files in. Exclude them to enable
132        // our test APK to build (has no effect on our AARs)
133        excludes += &quot;/META-INF/AL2.0&quot;
134        excludes += &quot;/META-INF/LGPL2.1&quot;
135    }
136}
137
138dependencies {
139    implementation Libs.Kotlin.stdlib
140    implementation Libs.Kotlin.Coroutines.android
141    implementation Libs.GoogleMaps.maps
142    implementation Libs.GoogleMaps.mapsKtx
143    constraints {
144        // Volley is a transitive dependency of maps
145        implementation(Libs.Volley.volley) {
146            because(&quot;Only volley 1.2.0 or newer are available on maven.google.com&quot;)
147        }
148    }
149
150    implementation Libs.Accompanist.insets
151    implementation Libs.AndroidX.Activity.activityCompose
152    implementation Libs.AndroidX.appcompat
153    implementation Libs.AndroidX.Compose.runtime
154    implementation Libs.AndroidX.Compose.foundation
155    implementation Libs.AndroidX.Compose.material
156    implementation Libs.AndroidX.Compose.layout
157    implementation Libs.AndroidX.Compose.animation
158    implementation Libs.AndroidX.Compose.tooling
159    implementation Libs.AndroidX.Lifecycle.viewModelCompose
160    implementation Libs.AndroidX.Lifecycle.viewModelKtx
161    implementation Libs.Coil.compose
162    implementation Libs.Hilt.android
163    kapt Libs.Hilt.compiler
164
165    androidTestImplementation Libs.JUnit.junit
166    androidTestImplementation Libs.AndroidX.Test.runner
167    androidTestImplementation Libs.AndroidX.Test.espressoCore
168    androidTestImplementation Libs.AndroidX.Test.rules
169    androidTestImplementation Libs.AndroidX.Test.Ext.junit
170    androidTestImplementation Libs.Kotlin.Coroutines.test
171    androidTestImplementation Libs.AndroidX.Compose.uiTest
172    androidTestImplementation Libs.Hilt.android
173    androidTestImplementation Libs.Hilt.testing
174    kaptAndroidTest Libs.Hilt.compiler
175}
176

Code at build.gradle.kts

1buildscript {
2    repositories {
3        google()
4    }
5    dependencies {
6        classpath Libs.androidGradlePlugin
7        classpath Libs.Kotlin.gradlePlugin
8        classpath Libs.Hilt.gradlePlugin
9    }
10}
11
12plugins {
13    id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17    repositories {
18        google()
19        mavenCentral()
20
21        if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22            maven { url Urls.composeSnapshotRepo }
23        }
24
25        if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26            maven { url Urls.mavenCentralSnapshotRepo }
27        }
28    }
29
30    apply plugin: 'com.diffplug.spotless'
31    spotless {
32        kotlin {
33            target '**/*.kt'
34            targetExclude(&quot;$buildDir/**/*.kt&quot;)
35            targetExclude('bin/**/*.kt')
36            ktlint(Versions.ktLint)
37            licenseHeaderFile rootProject.file('spotless/copyright.kt')
38        }
39    }
40
41    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42        kotlinOptions {
43            jvmTarget = &quot;1.8&quot;
44
45            // Use experimental APIs
46            freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47        }
48    }
49    // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50    configurations.configureEach {
51        resolutionStrategy {
52            force Libs.JUnit.junit
53        }
54    }
55}
56
57plugins {
58    id 'com.android.application'
59    id 'kotlin-android'
60    id 'kotlin-kapt'
61    id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file(&quot;local.properties&quot;).exists()) {
67    properties.load(rootProject.file(&quot;local.properties&quot;).newDataInputStream())
68}
69
70android {
71    compileSdkVersion 31
72    defaultConfig {
73        applicationId &quot;androidx.compose.samples.crane&quot;
74        minSdkVersion 21
75        targetSdkVersion 31
76        versionCode 1
77        versionName &quot;1.0&quot;
78        vectorDrawables.useSupportLibrary = true
79        testInstrumentationRunner &quot;androidx.compose.samples.crane.CustomTestRunner&quot;
80
81        manifestPlaceholders = [ googleMapsKey : properties.getProperty(&quot;google.maps.key&quot;, &quot;&quot;) ]
82    }
83
84    signingConfigs {
85        // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86        // Cert fingerprint = 
87        debug {
88            storeFile rootProject.file('debug.keystore')
89            storePassword 'xxxxxxxxxx'
90            keyAlias 'xxxxxxxxxxx'
91            keyPassword 'xxxxxxxxxx'
92        }
93    }
94
95    buildTypes {
96        debug {
97            signingConfig signingConfigs.debug
98        }
99
100        release {
101            minifyEnabled true
102            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103        }
104    }
105
106    compileOptions {
107        sourceCompatibility JavaVersion.VERSION_1_8
108        targetCompatibility JavaVersion.VERSION_1_8
109    }
110
111    kotlinOptions {
112        jvmTarget = &quot;1.8&quot;
113    }
114
115    buildFeatures {
116         compose true
117
118        // Disable unused AGP features
119        buildConfig false
120        aidl false
121        renderScript false
122        resValues false
123        shaders false
124    }
125
126    composeOptions {
127        kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128    }
129
130    packagingOptions {
131        // Multiple dependency bring these files in. Exclude them to enable
132        // our test APK to build (has no effect on our AARs)
133        excludes += &quot;/META-INF/AL2.0&quot;
134        excludes += &quot;/META-INF/LGPL2.1&quot;
135    }
136}
137
138dependencies {
139    implementation Libs.Kotlin.stdlib
140    implementation Libs.Kotlin.Coroutines.android
141    implementation Libs.GoogleMaps.maps
142    implementation Libs.GoogleMaps.mapsKtx
143    constraints {
144        // Volley is a transitive dependency of maps
145        implementation(Libs.Volley.volley) {
146            because(&quot;Only volley 1.2.0 or newer are available on maven.google.com&quot;)
147        }
148    }
149
150    implementation Libs.Accompanist.insets
151    implementation Libs.AndroidX.Activity.activityCompose
152    implementation Libs.AndroidX.appcompat
153    implementation Libs.AndroidX.Compose.runtime
154    implementation Libs.AndroidX.Compose.foundation
155    implementation Libs.AndroidX.Compose.material
156    implementation Libs.AndroidX.Compose.layout
157    implementation Libs.AndroidX.Compose.animation
158    implementation Libs.AndroidX.Compose.tooling
159    implementation Libs.AndroidX.Lifecycle.viewModelCompose
160    implementation Libs.AndroidX.Lifecycle.viewModelKtx
161    implementation Libs.Coil.compose
162    implementation Libs.Hilt.android
163    kapt Libs.Hilt.compiler
164
165    androidTestImplementation Libs.JUnit.junit
166    androidTestImplementation Libs.AndroidX.Test.runner
167    androidTestImplementation Libs.AndroidX.Test.espressoCore
168    androidTestImplementation Libs.AndroidX.Test.rules
169    androidTestImplementation Libs.AndroidX.Test.Ext.junit
170    androidTestImplementation Libs.Kotlin.Coroutines.test
171    androidTestImplementation Libs.AndroidX.Compose.uiTest
172    androidTestImplementation Libs.Hilt.android
173    androidTestImplementation Libs.Hilt.testing
174    kaptAndroidTest Libs.Hilt.compiler
175}
176repositories {
177    jcenter()
178}
179
180plugins {
181    `kotlin-dsl`
182}
183

ANSWER

Answered 2022-Feb-06 at 03:17

I don't know if it is critical for your problem but modifying this

1buildscript {
2    repositories {
3        google()
4    }
5    dependencies {
6        classpath Libs.androidGradlePlugin
7        classpath Libs.Kotlin.gradlePlugin
8        classpath Libs.Hilt.gradlePlugin
9    }
10}
11
12plugins {
13    id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17    repositories {
18        google()
19        mavenCentral()
20
21        if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22            maven { url Urls.composeSnapshotRepo }
23        }
24
25        if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26            maven { url Urls.mavenCentralSnapshotRepo }
27        }
28    }
29
30    apply plugin: 'com.diffplug.spotless'
31    spotless {
32        kotlin {
33            target '**/*.kt'
34            targetExclude(&quot;$buildDir/**/*.kt&quot;)
35            targetExclude('bin/**/*.kt')
36            ktlint(Versions.ktLint)
37            licenseHeaderFile rootProject.file('spotless/copyright.kt')
38        }
39    }
40
41    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42        kotlinOptions {
43            jvmTarget = &quot;1.8&quot;
44
45            // Use experimental APIs
46            freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47        }
48    }
49    // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50    configurations.configureEach {
51        resolutionStrategy {
52            force Libs.JUnit.junit
53        }
54    }
55}
56
57plugins {
58    id 'com.android.application'
59    id 'kotlin-android'
60    id 'kotlin-kapt'
61    id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file(&quot;local.properties&quot;).exists()) {
67    properties.load(rootProject.file(&quot;local.properties&quot;).newDataInputStream())
68}
69
70android {
71    compileSdkVersion 31
72    defaultConfig {
73        applicationId &quot;androidx.compose.samples.crane&quot;
74        minSdkVersion 21
75        targetSdkVersion 31
76        versionCode 1
77        versionName &quot;1.0&quot;
78        vectorDrawables.useSupportLibrary = true
79        testInstrumentationRunner &quot;androidx.compose.samples.crane.CustomTestRunner&quot;
80
81        manifestPlaceholders = [ googleMapsKey : properties.getProperty(&quot;google.maps.key&quot;, &quot;&quot;) ]
82    }
83
84    signingConfigs {
85        // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86        // Cert fingerprint = 
87        debug {
88            storeFile rootProject.file('debug.keystore')
89            storePassword 'xxxxxxxxxx'
90            keyAlias 'xxxxxxxxxxx'
91            keyPassword 'xxxxxxxxxx'
92        }
93    }
94
95    buildTypes {
96        debug {
97            signingConfig signingConfigs.debug
98        }
99
100        release {
101            minifyEnabled true
102            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103        }
104    }
105
106    compileOptions {
107        sourceCompatibility JavaVersion.VERSION_1_8
108        targetCompatibility JavaVersion.VERSION_1_8
109    }
110
111    kotlinOptions {
112        jvmTarget = &quot;1.8&quot;
113    }
114
115    buildFeatures {
116         compose true
117
118        // Disable unused AGP features
119        buildConfig false
120        aidl false
121        renderScript false
122        resValues false
123        shaders false
124    }
125
126    composeOptions {
127        kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128    }
129
130    packagingOptions {
131        // Multiple dependency bring these files in. Exclude them to enable
132        // our test APK to build (has no effect on our AARs)
133        excludes += &quot;/META-INF/AL2.0&quot;
134        excludes += &quot;/META-INF/LGPL2.1&quot;
135    }
136}
137
138dependencies {
139    implementation Libs.Kotlin.stdlib
140    implementation Libs.Kotlin.Coroutines.android
141    implementation Libs.GoogleMaps.maps
142    implementation Libs.GoogleMaps.mapsKtx
143    constraints {
144        // Volley is a transitive dependency of maps
145        implementation(Libs.Volley.volley) {
146            because(&quot;Only volley 1.2.0 or newer are available on maven.google.com&quot;)
147        }
148    }
149
150    implementation Libs.Accompanist.insets
151    implementation Libs.AndroidX.Activity.activityCompose
152    implementation Libs.AndroidX.appcompat
153    implementation Libs.AndroidX.Compose.runtime
154    implementation Libs.AndroidX.Compose.foundation
155    implementation Libs.AndroidX.Compose.material
156    implementation Libs.AndroidX.Compose.layout
157    implementation Libs.AndroidX.Compose.animation
158    implementation Libs.AndroidX.Compose.tooling
159    implementation Libs.AndroidX.Lifecycle.viewModelCompose
160    implementation Libs.AndroidX.Lifecycle.viewModelKtx
161    implementation Libs.Coil.compose
162    implementation Libs.Hilt.android
163    kapt Libs.Hilt.compiler
164
165    androidTestImplementation Libs.JUnit.junit
166    androidTestImplementation Libs.AndroidX.Test.runner
167    androidTestImplementation Libs.AndroidX.Test.espressoCore
168    androidTestImplementation Libs.AndroidX.Test.rules
169    androidTestImplementation Libs.AndroidX.Test.Ext.junit
170    androidTestImplementation Libs.Kotlin.Coroutines.test
171    androidTestImplementation Libs.AndroidX.Compose.uiTest
172    androidTestImplementation Libs.Hilt.android
173    androidTestImplementation Libs.Hilt.testing
174    kaptAndroidTest Libs.Hilt.compiler
175}
176repositories {
177    jcenter()
178}
179
180plugins {
181    `kotlin-dsl`
182}
183repositories {
184    jcenter()
185}
186

to

1buildscript {
2    repositories {
3        google()
4    }
5    dependencies {
6        classpath Libs.androidGradlePlugin
7        classpath Libs.Kotlin.gradlePlugin
8        classpath Libs.Hilt.gradlePlugin
9    }
10}
11
12plugins {
13    id 'com.diffplug.spotless' version '5.12.4'
14}
15
16subprojects {
17    repositories {
18        google()
19        mavenCentral()
20
21        if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
22            maven { url Urls.composeSnapshotRepo }
23        }
24
25        if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
26            maven { url Urls.mavenCentralSnapshotRepo }
27        }
28    }
29
30    apply plugin: 'com.diffplug.spotless'
31    spotless {
32        kotlin {
33            target '**/*.kt'
34            targetExclude(&quot;$buildDir/**/*.kt&quot;)
35            targetExclude('bin/**/*.kt')
36            ktlint(Versions.ktLint)
37            licenseHeaderFile rootProject.file('spotless/copyright.kt')
38        }
39    }
40
41    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
42        kotlinOptions {
43            jvmTarget = &quot;1.8&quot;
44
45            // Use experimental APIs
46            freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
47        }
48    }
49    // androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
50    configurations.configureEach {
51        resolutionStrategy {
52            force Libs.JUnit.junit
53        }
54    }
55}
56
57plugins {
58    id 'com.android.application'
59    id 'kotlin-android'
60    id 'kotlin-kapt'
61    id 'dagger.hilt.android.plugin'
62}
63
64// Reads the Google maps key that is used in the AndroidManifest
65Properties properties = new Properties()
66if (rootProject.file(&quot;local.properties&quot;).exists()) {
67    properties.load(rootProject.file(&quot;local.properties&quot;).newDataInputStream())
68}
69
70android {
71    compileSdkVersion 31
72    defaultConfig {
73        applicationId &quot;androidx.compose.samples.crane&quot;
74        minSdkVersion 21
75        targetSdkVersion 31
76        versionCode 1
77        versionName &quot;1.0&quot;
78        vectorDrawables.useSupportLibrary = true
79        testInstrumentationRunner &quot;androidx.compose.samples.crane.CustomTestRunner&quot;
80
81        manifestPlaceholders = [ googleMapsKey : properties.getProperty(&quot;google.maps.key&quot;, &quot;&quot;) ]
82    }
83
84    signingConfigs {
85        // We use a bundled debug keystore, to allow debug builds from CI to be upgradable
86        // Cert fingerprint = 
87        debug {
88            storeFile rootProject.file('debug.keystore')
89            storePassword 'xxxxxxxxxx'
90            keyAlias 'xxxxxxxxxxx'
91            keyPassword 'xxxxxxxxxx'
92        }
93    }
94
95    buildTypes {
96        debug {
97            signingConfig signingConfigs.debug
98        }
99
100        release {
101            minifyEnabled true
102            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
103        }
104    }
105
106    compileOptions {
107        sourceCompatibility JavaVersion.VERSION_1_8
108        targetCompatibility JavaVersion.VERSION_1_8
109    }
110
111    kotlinOptions {
112        jvmTarget = &quot;1.8&quot;
113    }
114
115    buildFeatures {
116         compose true
117
118        // Disable unused AGP features
119        buildConfig false
120        aidl false
121        renderScript false
122        resValues false
123        shaders false
124    }
125
126    composeOptions {
127        kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
128    }
129
130    packagingOptions {
131        // Multiple dependency bring these files in. Exclude them to enable
132        // our test APK to build (has no effect on our AARs)
133        excludes += &quot;/META-INF/AL2.0&quot;
134        excludes += &quot;/META-INF/LGPL2.1&quot;
135    }
136}
137
138dependencies {
139    implementation Libs.Kotlin.stdlib
140    implementation Libs.Kotlin.Coroutines.android
141    implementation Libs.GoogleMaps.maps
142    implementation Libs.GoogleMaps.mapsKtx
143    constraints {
144        // Volley is a transitive dependency of maps
145        implementation(Libs.Volley.volley) {
146            because(&quot;Only volley 1.2.0 or newer are available on maven.google.com&quot;)
147        }
148    }
149
150    implementation Libs.Accompanist.insets
151    implementation Libs.AndroidX.Activity.activityCompose
152    implementation Libs.AndroidX.appcompat
153    implementation Libs.AndroidX.Compose.runtime
154    implementation Libs.AndroidX.Compose.foundation
155    implementation Libs.AndroidX.Compose.material
156    implementation Libs.AndroidX.Compose.layout
157    implementation Libs.AndroidX.Compose.animation
158    implementation Libs.AndroidX.Compose.tooling
159    implementation Libs.AndroidX.Lifecycle.viewModelCompose
160    implementation Libs.AndroidX.Lifecycle.viewModelKtx
161    implementation Libs.Coil.compose
162    implementation Libs.Hilt.android
163    kapt Libs.Hilt.compiler
164
165    androidTestImplementation Libs.JUnit.junit
166    androidTestImplementation Libs.AndroidX.Test.runner
167    androidTestImplementation Libs.AndroidX.Test.espressoCore
168    androidTestImplementation Libs.AndroidX.Test.rules
169    androidTestImplementation Libs.AndroidX.Test.Ext.junit
170    androidTestImplementation Libs.Kotlin.Coroutines.test
171    androidTestImplementation Libs.AndroidX.Compose.uiTest
172    androidTestImplementation Libs.Hilt.android
173    androidTestImplementation Libs.Hilt.testing
174    kaptAndroidTest Libs.Hilt.compiler
175}
176repositories {
177    jcenter()
178}
179
180plugins {
181    `kotlin-dsl`
182}
183repositories {
184    jcenter()
185}
186repositories {
187    mavenCentral()
188}
189

should be needed. Because jcenter() is obsolete.

Source https://stackoverflow.com/questions/69307474

QUESTION

Angular TSLint - Cannot find builder &quot;@angular-devkit/build-angular:tslint&quot;

Asked 2022-Jan-04 at 13:18

When I try to run command ng lint --fix cli throws this error:

1An unhandled exception occurred: Cannot find builder &quot;@angular-devkit/build-angular:tslint&quot;.
2See &quot;C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log&quot; for further details.
3

My lint confing in angular.json:

1An unhandled exception occurred: Cannot find builder &quot;@angular-devkit/build-angular:tslint&quot;.
2See &quot;C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log&quot; for further details.
3&quot;lint&quot;: {
4  &quot;builder&quot;: &quot;@angular-devkit/build-angular:tslint&quot;,
5  &quot;options&quot;: {
6    &quot;tsConfig&quot;: [
7      &quot;projects/wepod-app/tsconfig.app.json&quot;,
8      &quot;projects/wepod-app/tsconfig.spec.json&quot;,
9      &quot;projects/wepod-app/e2e/tsconfig.json&quot;
10    ],
11    &quot;exclude&quot;: [
12      &quot;**/node_modules/**&quot;
13    ]
14  }
15},
16

My package.json:

1An unhandled exception occurred: Cannot find builder &quot;@angular-devkit/build-angular:tslint&quot;.
2See &quot;C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log&quot; for further details.
3&quot;lint&quot;: {
4  &quot;builder&quot;: &quot;@angular-devkit/build-angular:tslint&quot;,
5  &quot;options&quot;: {
6    &quot;tsConfig&quot;: [
7      &quot;projects/wepod-app/tsconfig.app.json&quot;,
8      &quot;projects/wepod-app/tsconfig.spec.json&quot;,
9      &quot;projects/wepod-app/e2e/tsconfig.json&quot;
10    ],
11    &quot;exclude&quot;: [
12      &quot;**/node_modules/**&quot;
13    ]
14  }
15},
16{
17  &quot;name&quot;: &quot;wepod-clients&quot;,
18  &quot;version&quot;: &quot;3.2.3&quot;,
19  &quot;scripts&quot;: {
20    &quot;ng&quot;: &quot;ng&quot;,
21    &quot;start&quot;: &quot;node patch.js &amp;&amp; ng serve&quot;,
22    &quot;build&quot;: &quot;node patch.js &amp;&amp; node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng run wepod-app:app-shell:production &amp;&amp; ng run wepod-app:auth-standalone:production&quot;,
23    &quot;server&quot;: &quot;npm run build &amp;&amp; http-server -p 9090 -c-1 dist&quot;,
24    &quot;test&quot;: &quot;ng test&quot;,
25    &quot;lint&quot;: &quot;ng lint --fix&quot;,
26    &quot;e2e&quot;: &quot;ng e2e&quot;,
27    &quot;postinstall&quot;: &quot;node patch.js &amp;&amp; ngcc&quot;,
28    &quot;postbuild&quot;: &quot;node post-build.js&quot;,
29    &quot;prepare&quot;: &quot;husky install&quot;,
30    &quot;build-latest&quot;: &quot;git pull origin production &amp;&amp; npm run build&quot;
31  },
32  &quot;private&quot;: true,
33  &quot;dependencies&quot;: {
34    &quot;@angular/animations&quot;: &quot;^13.0.0&quot;,
35    &quot;@angular/cdk&quot;: &quot;^13.0.0&quot;,
36    &quot;@angular/cli&quot;: &quot;^13.0.1&quot;,
37    &quot;@angular/common&quot;: &quot;^13.0.0&quot;,
38    &quot;@angular/compiler&quot;: &quot;^13.0.0&quot;,
39    &quot;@angular/core&quot;: &quot;^13.0.0&quot;,
40    &quot;@angular/forms&quot;: &quot;^13.0.0&quot;,
41    &quot;@angular/localize&quot;: &quot;^13.0.0&quot;,
42    &quot;@angular/platform-browser&quot;: &quot;^13.0.0&quot;,
43    &quot;@angular/platform-browser-dynamic&quot;: &quot;^13.0.0&quot;,
44    &quot;@angular/platform-server&quot;: &quot;^13.0.0&quot;,
45    &quot;@angular/router&quot;: &quot;^13.0.0&quot;,
46    &quot;@angular/service-worker&quot;: &quot;^13.0.0&quot;,
47    &quot;@types/video.js&quot;: &quot;^7.3.27&quot;,
48    &quot;animate.css&quot;: &quot;^4.1.1&quot;,
49    &quot;assert&quot;: &quot;^2.0.0&quot;,
50    &quot;bowser&quot;: &quot;^2.11.0&quot;,
51    &quot;buffer&quot;: &quot;^6.0.3&quot;,
52    &quot;bundle-loader&quot;: &quot;^0.5.6&quot;,
53    &quot;compare-version&quot;: &quot;^0.1.2&quot;,
54    &quot;constants-browserify&quot;: &quot;^1.0.0&quot;,
55    &quot;crypto-browserify&quot;: &quot;^3.12.0&quot;,
56    &quot;crypto-js&quot;: &quot;^4.1.1&quot;,
57    &quot;d3&quot;: &quot;^6.5.0&quot;,
58    &quot;hammerjs&quot;: &quot;^2.0.8&quot;,
59    &quot;https-browserify&quot;: &quot;^1.0.0&quot;,
60    &quot;jalali-moment&quot;: &quot;^3.3.10&quot;,
61    &quot;lottie-web&quot;: &quot;^5.7.13&quot;,
62    &quot;lzutf8&quot;: &quot;^0.6.0&quot;,
63    &quot;net&quot;: &quot;^1.0.2&quot;,
64    &quot;ng-gallery&quot;: &quot;^5.1.1&quot;,
65    &quot;ng2-jalali-date-picker&quot;: &quot;^2.4.2&quot;,
66    &quot;ngx-device-detector&quot;: &quot;^1.5.2&quot;,
67    &quot;ngx-doughnut-chart&quot;: &quot;0.0.4&quot;,
68    &quot;ngx-infinite-scroll&quot;: &quot;^8.0.2&quot;,
69    &quot;ngx-lottie&quot;: &quot;^7.0.4&quot;,
70    &quot;ngx-owl-carousel-o&quot;: &quot;^3.1.1&quot;,
71    &quot;ngx-skeleton-loader&quot;: &quot;^2.10.1&quot;,
72    &quot;ngx-toastr&quot;: &quot;^12.1.0&quot;,
73    &quot;os-browserify&quot;: &quot;^0.3.0&quot;,
74    &quot;podchat-browser&quot;: &quot;^10.14.13&quot;,
75    &quot;rxjs&quot;: &quot;^6.6.7&quot;,
76    &quot;stream-browserify&quot;: &quot;^3.0.0&quot;,
77    &quot;stream-http&quot;: &quot;^3.2.0&quot;,
78    &quot;tls&quot;: &quot;0.0.1&quot;,
79    &quot;tslib&quot;: &quot;^2.0.0&quot;,
80    &quot;uuid&quot;: &quot;^8.3.2&quot;,
81    &quot;video.js&quot;: &quot;^7.15.4&quot;,
82    &quot;videojs-record&quot;: &quot;^4.5.0&quot;,
83    &quot;zone.js&quot;: &quot;~0.11.4&quot;
84  },
85  &quot;devDependencies&quot;: {
86    &quot;@angular-devkit/build-angular&quot;: &quot;^13.0.1&quot;,
87    &quot;@angular-devkit/core&quot;: &quot;^13.0.1&quot;,
88    &quot;@angular/compiler-cli&quot;: &quot;^13.0.0&quot;,
89    &quot;@angular/language-service&quot;: &quot;^13.0.0&quot;,
90    &quot;@egjs/hammerjs&quot;: &quot;^2.0.17&quot;,
91    &quot;@types/hammerjs&quot;: &quot;^2.0.40&quot;,
92    &quot;@types/jasmine&quot;: &quot;~3.6.0&quot;,
93    &quot;@types/jasminewd2&quot;: &quot;^2.0.10&quot;,
94    &quot;@types/node&quot;: &quot;^12.20.36&quot;,
95    &quot;codelyzer&quot;: &quot;^6.0.0&quot;,
96    &quot;colors&quot;: &quot;^1.4.0&quot;,
97    &quot;git-tag-version&quot;: &quot;^1.3.1&quot;,
98    &quot;gulp&quot;: &quot;^4.0.2&quot;,
99    &quot;gulp-gzip&quot;: &quot;^1.4.2&quot;,
100    &quot;http-server&quot;: &quot;^14.0.0&quot;,
101    &quot;husky&quot;: &quot;^7.0.4&quot;,
102    &quot;jasmine-core&quot;: &quot;~3.6.0&quot;,
103    &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;,
104    &quot;karma&quot;: &quot;^6.3.7&quot;,
105    &quot;karma-chrome-launcher&quot;: &quot;~3.1.0&quot;,
106    &quot;karma-coverage-istanbul-reporter&quot;: &quot;^2.1.0&quot;,
107    &quot;karma-jasmine&quot;: &quot;~4.0.0&quot;,
108    &quot;karma-jasmine-html-reporter&quot;: &quot;^1.5.0&quot;,
109    &quot;protractor&quot;: &quot;^7.0.0&quot;,
110    &quot;ts-node&quot;: &quot;^8.10.2&quot;,
111    &quot;tslint&quot;: &quot;^6.1.3&quot;,
112    &quot;typescript&quot;: &quot;4.4.4&quot;,
113    &quot;zip-dir&quot;: &quot;^2.0.0&quot;
114  },
115  &quot;browser&quot;: {
116    &quot;fs&quot;: false,
117    &quot;path&quot;: false,
118    &quot;os&quot;: false
119  }
120}
121

ANSWER

Answered 2021-Nov-28 at 10:34

From v13 angular doesn't use tslint anymore due to deprecation.

Run ng add @angular-eslint/schematics to add eslint to your application.

It will use tslint-to-eslint-config to migrate you to eslint automatically.

It will generate a .eslintrc.json file and migrate tslint.json to it.

Nothing else is needed to be done.

Source https://stackoverflow.com/questions/70141707

QUESTION

SVG stop running chained animation (&lt;animate&gt; tag)

Asked 2021-Dec-26 at 09:01

I have an animated SVG where each <path> starts after its previous <path>. The first <path> starts on click or 0s.
I have a problem with stopping the animation (without JS, only in XML). I press click, the animation starts. Before the entire animation ends I press click and trigger a new animation. However the previous animation continues to run and it messes up all <path>s starting from 2.
I have tried different options (begin with time offsets; begin with id.end), but I haven't found a solution. Maybe someone who is more experiences with SVG than me could help me?

Here is my SVG:

1&lt;svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" id="3005"&gt;
2&lt;g fill="none" stroke="#666" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"&gt;
3    &lt;g&gt;
4        &lt;path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" /&gt;
5        &lt;path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" /&gt;
6        &lt;path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" /&gt;
7    &lt;/g&gt;
8&lt;/g&gt;
9&lt;g fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"&gt;
10    &lt;g&gt;
11        &lt;path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" stroke-dasharray="67.92" stroke-dashoffset="67.92"&gt;
12            &lt;animate id="0" attributeName="stroke-dashoffset" values="67.92;0" dur="0.51s" fill="freeze" begin="0s;3005.click" /&gt;
13        &lt;/path&gt;
14        &lt;path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" stroke-dasharray="87.4" stroke-dashoffset="87.4"&gt;
15            &lt;animate attributeName="stroke-dashoffset" values="87.4" fill="freeze" begin="3005.click" /&gt;
16            &lt;animate id="1" attributeName="stroke-dashoffset" values="87.4;0" dur="0.66s" fill="freeze" begin="0.end" /&gt;
17        &lt;/path&gt;
18        &lt;path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" stroke-dasharray="41.01" stroke-dashoffset="41.01"&gt;
19            &lt;animate attributeName="stroke-dashoffset" values="41.01" fill="freeze" begin="3005.click" /&gt;
20            &lt;animate id="2" attributeName="stroke-dashoffset" values="41.01;0" dur="0.41s" fill="freeze" begin="1.end" /&gt;
21        &lt;/path&gt;
22    &lt;/g&gt;
23&lt;/g&gt;
24&lt;/svg&gt;

And here is the problem:
So, on the picture it's clear that the chained animation is not stopped when I click the pictue :(
enter image description here

ANSWER

Answered 2021-Dec-26 at 09:01

Instead of chaining animations off one another, have all the animations begin="0s; 3005.click". Then they will all reset when you click.

You can use keyPoints and keyTimes, to control when each of the animations starts. So you can still have your staggered starts.

1&lt;svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" id="3005"&gt;
2&lt;g fill="none" stroke="#666" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"&gt;
3    &lt;g&gt;
4        &lt;path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" /&gt;
5        &lt;path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" /&gt;
6        &lt;path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" /&gt;
7    &lt;/g&gt;
8&lt;/g&gt;
9&lt;g fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"&gt;
10    &lt;g&gt;
11        &lt;path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" stroke-dasharray="67.92" stroke-dashoffset="67.92"&gt;
12            &lt;animate id="0" attributeName="stroke-dashoffset" values="67.92;0" dur="0.51s" fill="freeze" begin="0s;3005.click" /&gt;
13        &lt;/path&gt;
14        &lt;path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" stroke-dasharray="87.4" stroke-dashoffset="87.4"&gt;
15            &lt;animate attributeName="stroke-dashoffset" values="87.4" fill="freeze" begin="3005.click" /&gt;
16            &lt;animate id="1" attributeName="stroke-dashoffset" values="87.4;0" dur="0.66s" fill="freeze" begin="0.end" /&gt;
17        &lt;/path&gt;
18        &lt;path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" stroke-dasharray="41.01" stroke-dashoffset="41.01"&gt;
19            &lt;animate attributeName="stroke-dashoffset" values="41.01" fill="freeze" begin="3005.click" /&gt;
20            &lt;animate id="2" attributeName="stroke-dashoffset" values="41.01;0" dur="0.41s" fill="freeze" begin="1.end" /&gt;
21        &lt;/path&gt;
22    &lt;/g&gt;
23&lt;/g&gt;
24&lt;/svg&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" width="109" height="109" viewBox="0 0 109 109" id="3005"&gt;
25&lt;g fill="none" stroke="#666" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"&gt;
26    &lt;g&gt;
27        &lt;path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" /&gt;
28        &lt;path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" /&gt;
29        &lt;path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" /&gt;
30    &lt;/g&gt;
31&lt;/g&gt;
32&lt;g fill="none" stroke="#000" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"&gt;
33    &lt;g&gt;
34        &lt;path d="M50.75,19.5c0.1,1.3,0.37,3.74-0.19,5.21C43.57,43,32.73,60.29,14.5,75.04" stroke-dasharray="67.92" stroke-dashoffset="67.92"&gt;
35            &lt;animate attributeName="stroke-dashoffset" values="67.92;0" dur="0.51s" fill="freeze" begin="0s;3005.click" /&gt;
36        &lt;/path&gt;
37        &lt;path d="M45,44.35c1.05,0,3.62,0.35,6.26,0.1c9.18-0.85,25.21-3.31,29.06-3.67c4.26-0.4,6.46,4.28,4.68,6.25C78.32,54.46,67.5,67,57.81,79.22" stroke-dasharray="87.4" stroke-dashoffset="87.4"&gt;
38            &lt;animate attributeName="stroke-dashoffset" values="87.4" fill="freeze" begin="3005.click" /&gt;
39            &lt;animate attributeName="stroke-dashoffset" values="87.4;87.4;0" keyTimes="0;0.444;1" dur="1.17s" fill="freeze" begin="0s;3005.click" /&gt;
40        &lt;/path&gt;
41        &lt;path d="M42.52,68.33c10.16,5.01,26.25,20.59,28.79,28.38" stroke-dasharray="41.01" stroke-dashoffset="41.01"&gt;
42            &lt;animate attributeName="stroke-dashoffset" values="41.01" fill="freeze" begin="3005.click" /&gt;
43            &lt;animate attributeName="stroke-dashoffset" values="41.01;41.01;0" keyTimes="0;0.75;1" dur="1.58s" fill="freeze" begin="0s;3005.click" /&gt;
44        &lt;/path&gt;
45    &lt;/g&gt;
46&lt;/g&gt;
47&lt;/svg&gt;

Source https://stackoverflow.com/questions/70475974

QUESTION

How to replace deprecated .animation() in SwiftUI?

Asked 2021-Nov-28 at 16:09

The .animation() modifier has been deprecated in iOS 15, but I'm not sure I understand how Xcode's suggested equivalent, animation(_:value:), works.

1.animation(.easeInOut(duration: 2)) // ⚠️'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead.
2

How would I change my code to get rid of the warning?

ANSWER

Answered 2021-Oct-05 at 00:30

.animation now takes a second argument called value.

https://developer.apple.com/documentation/swiftui/view/animation(_:value:)

Source https://stackoverflow.com/questions/69443588

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Animation

Tutorials and Learning Resources are not available at this moment for Animation

Share this Page

share link

Get latest updates on Animation