Home JS special effects html5 special effects HTML5 circular wave loading animation special effects

HTML5 circular wave loading animation special effects

HTML5 circular wave loading animation special effects

HTML5 circular wave loading animation special effects

HTML5 circular wave loading animation special effect is a native HTML5+css3+canvas wave rolling rising loading animation with circular loading container effect.

var wave = (function () {

var ctx;
var waveImage;
var canvasWidth;
var canvasHeight;
var needAnimate = false;

function init (callback) {
var wave = document.getElementById('wave');
var canvas = document.createElement('canvas');
if (!canvas.getContext) return;
ctx = canvas.getContext('2d');
canvasWidth = wave.offsetWidth;
canvasHeight = wave.offsetHeight;
canvas.setAttribute('width', canvasWidth);
canvas.setAttribute('height', canvasHeight);
wave.appendChild(canvas);
waveImage = new Image();
waveImage.onload = function () {
waveImage.onload = null;
callback();
}
waveImage.src = 'images/wave.png';
}

function animate () {
var waveX = 0;
var waveY = 0;
var waveX_min = -203;
var waveY_max = canvasHeight * 0.7;
var requestAnimationFrame =
window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) { window.setTimeout(callback, 1000 / 60); };
function loop () {
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
if (!needAnimate) return;
if (waveY < waveY_max) waveY += 1.5;
if (waveX < waveX_min) waveX = 0; else waveX -= 3;

ctx.globalCompositeOperation = 'source-over';
ctx.beginPath();
ctx.arc(canvasWidth/2, canvasHeight/2, canvasHeight/2, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();

ctx.globalCompositeOperation = 'source-in';
ctx.drawImage(waveImage, waveX, canvasHeight - waveY);

requestAnimationFrame(loop);
}
loop();
}

function start () {
if (!ctx) return init(start);
needAnimate = true;
setTimeout(function () {
if (needAnimate) animate();
}, 500);
}
function stop () {
needAnimate = false;
}
return {start: start, stop: stop};
}());
wave.start();
Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

Text animation special effects based on HTML5 Canvas Text animation special effects based on HTML5 Canvas

02 Apr 2018

This article shares with you the text animation special effects based on HTML5 Canvas. It is very useful. Friends in need can use it for reference.

Loading animation special effects based on HTML5 Canvas and Rebound animation Loading animation special effects based on HTML5 Canvas and Rebound animation

19 Jan 2017

This is a Loading animation special effect based on HTML5 Canvas and Rebound animation. The loading animation uses a canvas to cover the entire page and displays a polygonal loading loader to represent the loading progress.

Loading animation special effects introductory tutorial Loading animation special effects introductory tutorial

12 Jun 2017

The code case sharing code for using CSS3 to implement Loading animation special effects is as follows: &lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt; &lt;meta charset="UTF-8"&gt; &nb

Detailed introduction to 7 amazing HTML5 particle animation special effects Detailed introduction to 7 amazing HTML5 particle animation special effects

06 Mar 2017

One of the great advantages of HTML5 is that it can more conveniently and efficiently create particle animation special effects on web pages, especially the Canvas feature, which can draw any graphics and animation on web pages. This article will share 7 amazing HTML5 particle animation effects. These particle effects provide source code download for everyone to learn. 1. HTML5 Canvas particle simulation effect This is a 30,000 particle animation simulated using HTML5 Canvas. When you move the mouse on the canvas, some particles around the mouse will move with you and form a certain pattern. Just like you are playing with sand art, the effect...

A graphic and text appreciation of 8 gorgeous HTML5 text animation special effects A graphic and text appreciation of 8 gorgeous HTML5 text animation special effects

06 Mar 2017

Text is the soul of web pages. A long time ago, someone invented many beautiful computer fonts, which gave web pages different styles. With the emergence of HTML5 and CSS3, we can make text more personalized. In some situations where necessary, we can even use HTML5 to animate text. This article shares 8 very gorgeous HTML5 text animation special effects, I hope it can be used as a reference for you. 1. CSS3 3D folding and flipping text animation Today we are going to share a CSS3 text special effects application. It is similar to the HTML5/CSS3 text effects shared before. It is also a CSS3 3D folding and flipping text animation, only...

HTML5 css3 progress bar countdown animation special effects code [recommended]_html5 tutorial skills HTML5 css3 progress bar countdown animation special effects code [recommended]_html5 tutorial skills

16 May 2016

The editor below will share with you an HTML5 css3 progress bar countdown animation special effects code [recommended]. Hope it helps everyone. Let’s follow the editor and take a look.

Based on css3 cool page loading animation special effects code_html/css_WEB-ITnose Based on css3 cool page loading animation special effects code_html/css_WEB-ITnose

24 Jun 2016

Based on css3 cool page loading animation special effects code

How to use HTML5+css3 to achieve particle effect text animation special effects (complete code attached) How to use HTML5+css3 to achieve particle effect text animation special effects (complete code attached)

25 Sep 2018

When we browse web pages, we will find that today’s web pages are becoming more and more beautiful, and many animation special effects are becoming more and more cool. This is inseparable from the in-depth development of HTML5 and CSS3. Today we are going to share a text effect based on HTML5 and CSS3 - particle effect text animation effect. The content of this article is about how to use HTML5+css3 to achieve particle effect text animation special effects. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

HTML5 cool responsive video background animation special effects HTML5 cool responsive video background animation special effects

18 Jan 2017

This is a cool HTML5 responsive video background animation effect. This video background can adapt the video to the size of the screen to create cool dynamic video background effects.

See all articles See all articles

Hot Tools

HTML5 Canvas heart fluttering animation special effects

HTML5 Canvas heart fluttering animation special effects

HTML5 Canvas heart fluttering animation special effect is a generated animation that can be directly opened with a browser to see a heart.

H5 panda bouncing game source code

H5 panda bouncing game source code

HTML5 Mobile Panda is also a crazy game source code. Game description: Press and hold the screen to adjust the strength of the panda spring and jump to the stone pillar. The game ends if you fall into the river.

HTML5 Valentine's Day box animation special effects

HTML5 Valentine's Day box animation special effects

Based on svg, draw animations of opening love box gifts on Valentine's Day, and special effects of love box animation.

H5 3D rolling ball game source code

H5 3D rolling ball game source code

HTML5 cool 3D ball rolling mobile game code download. Game introduction: A colored ball rolls, and the current track of the colored ball is controlled by dragging it with the mouse or the touch screen of the mobile phone. This is a simple and easy-to-operate mobile game source code.