


Examples to explain how to use SVG to create loading animation_html5 tutorial skills
Today I would like to share with you a loading animation based on SVG images. Nowadays, mobile web pages are mostly used. If you also use GIF for loading images, it may affect the quality of the image, so using SVG is a good way. .
The code shown this time was written by Aurer. Front-end personnel only need to directly copy the desired SVG code to use it directly, and the color can be changed. Of course, for students who are eager to learn, you can also study the writing principle of this code.
Usage Tutorial
Next, the editor of Design Expert Network will explain how to use this. It is actually quite simple.
STEP 1: Copy the SVG loading animation code you want into the
. The editor can copy a code as follows:- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve">
- <rect x="0" y="0" width="4" height="10" fill="#333" transform="translate(0 15.1665)">
- <animateTransform attributeType="xml" attributeName="transform" type="translate" values="0 0; 0 20; 0 0" begin="0" dur="0.6s" repeatCount="indefinite">animateTransform>
- rect>
- <rect x="10" y="0" width="4" height="10" fill="#333" transform="translate(0 11.5002)">
- <animateTransform attributeType="xml" attributeName="transform" type="translate" values="0 0; 0 20; 0 0" begin="0.2s" dur="0.6s" repeatCount="indefinite">animateTransform>
- rect>
- <rect x="20" y="0" width="4" height="10" fill="#333" transform="translate(0 1.83315)">
- <animateTransform attributeType="xml" attributeName="transform" type="translate" values="0 0; 0 20; 0 0" begin="0.4s" dur="0.6s" repeatCount="indefinite">animateTransform>
- rect>
- svg>
此时代码已经可以带动画了,但没颜色,请继续看STEP2添加颜色。
STEP 2 : 为SVG图像添加颜色
给你的样式表添加如下样式,里面的颜色代码换上你喜欢的即!
- <style>
- svg path,svg rect{fill: #FF6700;}
- style>
Done! Final DEMO:
The loading animation in the ionic library is used
ionic is an open source, free code library used to develop hybrid mobile applications. It can optimize the performance of html, css and js, build efficient applications, and can also be used to build optimizations for Sass and AngularJS. ionic will be a trustworthy framework.
The installation is very simple. If you have npm, open the command line tool on Windows and Linux and execute the following command:
Use the following command on Mac system:
Tips: IOS needs to be installed and used under Mac Os X. and Xcode environments.
If you have already installed the above environment, you can execute the following command to update the version:
or

Let’s take a look at two specific loading-related usages:
ionic loading action $ionicLoading
$ionicLoading is a default loading interaction effect of ionic. The content inside can also be modified in the template.
Usage example:
HTML code:
- <html ng-app="ionicApp">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
- <title>Ionic Modaltitle>
- <link href="http://www.runoob.com/static/ionic/css/ionic.min.css" rel="stylesheet">
- <script src="http://www.runoob.com/static/ionic/js/ionic.bundle.min.js">script>
- head>
- <body ng-controller="AppCtrl">
- <ion-view title="Home">
- <ion-header-bar>
- <h1 class="title">The Stoogesh1>
- ion-header-bar>
- <ion-content has-header="true">
- <ion-list>
- <ion-item ng-repeat="stooge in stooges" href="#">{{stooge.name}}ion-item>
- ion-list>
- ion-content>
- ion-view>
- body>
- html>
JavaScript 代码
- angular.module(‘ionicApp‘, [‘ionic‘])
- .controller(‘AppCtrl‘, function($scope, $timeout, $ionicLoading) {
- // Setup the loader
- $ionicLoading.show({
- content: ‘Loading‘,
- animation: ‘fade-in‘,
- showBackdrop: true,
- maxWidth: 200,
- showDelay: 0
- });
- // Set a timeout to clear loader, however you would actually call the $ionicLoading.hide(); method whenever everything is ready or loaded.
- $timeout(function () {
- $ionicLoading.hide();
- $scope.stooges = [{name: ‘Moe‘}, {name: ‘Larry‘}, {name: ‘Curly‘}];
- }, 2000);
- });
$ionicLoadingConfig
使用实例:
HTML 代码
- <ion-content scroll="false" class="has-header">
- <p>
- <ion-spinner icon="android">ion-spinner>
- <ion-spinner icon="ios">ion-spinner>
- <ion-spinner icon="ios-small">ion-spinner>
- <ion-spinner icon="bubbles" class="spinner-balanced">ion-spinner>
- <ion-spinner icon="circles" class="spinner-energized">ion-spinner>
- p>
- <p>
- <ion-spinner icon="crescent" class="spinner-royal">ion-spinner>
- <ion-spinner icon="dots" class="spinner-dark">ion-spinner>
- <ion-spinner icon="lines" class="spinner-calm">ion-spinner>
- <ion-spinner icon="ripple" class="spinner-assertive">ion-spinner>
- <ion-spinner icon="spiral">ion-spinner>
- p>
- ion-content>
CSS 代码
- body {
- cursor: url(‘http://www.runob.com/try/demo_source/finger.png‘), auto;
- }
- p {
- text-align: center;
- margin-bottom: 40px !important;
- }
- .spinner svg {
- width: 19% !important;
- height: 85px !important;
- }
JavaScript 代码
- angular.module(‘ionicApp‘, [‘ionic‘])
- .controller(‘MyCtrl‘, function($scope) {
- });

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics


![Error loading plugin in Illustrator [Fixed]](https://img.php.cn/upload/article/000/465/014/170831522770626.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
When launching Adobe Illustrator, does a message about an error loading the plug-in pop up? Some Illustrator users have encountered this error when opening the application. The message is followed by a list of problematic plugins. This error message indicates that there is a problem with the installed plug-in, but it may also be caused by other reasons such as a damaged Visual C++ DLL file or a damaged preference file. If you encounter this error, we will guide you in this article to fix the problem, so continue reading below. Error loading plug-in in Illustrator If you receive an "Error loading plug-in" error message when trying to launch Adobe Illustrator, you can use the following: As an administrator

Subtitles not working on Stremio on your Windows PC? Some Stremio users reported that subtitles were not displayed in the videos. Many users reported encountering an error message that said "Error loading subtitles." Here is the full error message that appears with this error: An error occurred while loading subtitles Failed to load subtitles: This could be a problem with the plugin you are using or your network. As the error message says, it could be your internet connection that is causing the error. So please check your network connection and make sure your internet is working properly. Apart from this, there could be other reasons behind this error, including conflicting subtitles add-on, unsupported subtitles for specific video content, and outdated Stremio app. like

How to use SVG to achieve image mosaic effect without using Javascript? The following article will give you a detailed understanding, I hope it will be helpful to you!

If you encounter freezing issues when inserting hyperlinks into Outlook, it may be due to unstable network connections, old Outlook versions, interference from antivirus software, or add-in conflicts. These factors may cause Outlook to fail to handle hyperlink operations properly. Fix Outlook freezes when inserting hyperlinks Use the following fixes to fix Outlook freezes when inserting hyperlinks: Check installed add-ins Update Outlook Temporarily disable your antivirus software and then try creating a new user profile Fix Office apps Program Uninstall and reinstall Office Let’s get started. 1] Check the installed add-ins. It may be that an add-in installed in Outlook is causing the problem.

With the development of the Internet, more and more web pages need to support scrolling loading, and infinite scrolling loading is one of them. It allows the page to continuously load new content, allowing users to browse the web more smoothly. In this article, we will introduce how to implement infinite scroll loading using PHP. 1. What is infinite scroll loading? Infinite scroll loading is a method of loading web content based on scroll bars. Its principle is that when the user scrolls to the bottom of the page, background data is asynchronously retrieved through AJAX to continuously load new content. This kind of loading method

The solutions to the problem that CSS cannot be loaded include checking the file path, checking the file content, clearing the browser cache, checking the server settings, using developer tools and checking the network connection. Detailed introduction: 1. Check the file path. First, please make sure the path of the CSS file is correct. If the CSS file is located in a different part or subdirectory of the website, you need to provide the correct path. If the CSS file is located in the root directory, the path should be direct. ; 2. Check the file content. If the path is correct, the problem may lie in the CSS file itself. Open the CSS file to check, etc.

svg can be converted to jpg format by using image processing software, using online conversion tools, and using the Python image processing library. Detailed introduction: 1. Image processing software includes Adobe Illustrator, Inkscape and GIMP; 2. Online conversion tools include CloudConvert, Zamzar, Online Convert, etc.; 3. Python image processing library, etc.

When installing the win7 system, some netizens encountered a situation where loading the USB driver failed. The USB device could not be recognized in the new win7 system, and common USB flash drives, mice and other devices could not be used. So what should I do if the installation of win7 fails to load the USB driver? Let Xiaobai teach you how to solve the problem of failure to load the USB driver when installing win7. Method 1: 1. First, we turn on the computer and enter the computer system, and check the computer system version in the computer system. Confirm whether the version of the computer system is consistent with the version of the device driver. 2. After confirming the driver version, connect the USB device to the computer system. The computer system shows that the device cannot connect to the system. 3. On the connection information page, click the Help button to view the help information. 4. If the computer department
