A small test, the implementation of six simple common HTML5 canvas effect filter, and encapsulated into a pure JavaScript callable API file Gloomyfishfilter.js.
the supported effects filters are:
1. Anti-color
2. Gray tone
3. Fuzzy
4. Relief
5. Carving
6. Mirroring
Filter Principle Explanation:
1. Inverse color: Gets a pixel point RGB value R, G, b the new RGB value is (255-r, 255-g, 255-b)
2. Gray tune
Comments: This article mainly introduces two code examples of HTML5 Canvas rotation animation to achieve the effect of a rotating Canvas. For friends who want to learn HTML5 Canvas rotation animation, refer
:
Method 1:The Code is
A. Circular motion
1.1 Thought Analysis:
The equations of the circle are:
(x0, y0) is the center of the circle; (x, y) is the point on the circle.(x-x0) ^ 2 + (y-y0) ^ 2 = r ^ 2cos (angle) ^ 2 + sin (angle) ^ 2 = 1Therefore, the combination of the above two-type, can be:
x = R * cos (angle) + x0y = R * sin (angle) + y0
Therefore, the sine function is used to compute the y-coordinate and the cosine function is used to compute the x-coordinate.
1.2 Examp
() {Window.requestanimationframe (Drawframe, canvas);BALL.Y = Math.sin (angle) * range;Angle + = speed;Ball.draw (context);})();
The following code can be printed in the console to understand the numerical distribution of the lower sine wave:
var Fullradians = Math.PI * 2;for (var angle = 0; angle Console.log (Math.sin (angle));}
Three. Examples:
Code:
Window.onload = function () {var
This is an example of the combination of canvas technology and video technology in HTML5. Effect Chart:
The following code does not run and provides only learning viewing. To preview this instance, browse Http://html5demos.com/video-canvas
(Browser support: Only Safari, Firefox)
First, let's look at a first-line effect chart:
To draw other graphics, you need to use a path, use a path that contains 4 steps, start creating the path, create the path to the shape, finish the path creation, close the path and set the drawing style, call the drawing method, and draw the path.
Core content:
Draws a path. moveTo.lineTo.bezierCurveTo
Example 2,canvas Draw a circle
HTML5 Canvas canvas and html5 Canvas
Use html5 canvas elements to draw images on webpages using JavaScript.
Draw a circle by specifying the size, color, and position:
Draw a line by s
HTML5 Canvas: initial Canvas, html5 initial canvas
Canvas and HTML 5 can be used to do many things, such as drawing, animation, and game development.
Canvas Element
HTML5 three.js Ambient light on canvas (HTML5 canvas three.js Ambient Lighting)The beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)This article follows "Attribution-non-commercial use-consistent" authoring public agreementReprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses
HTML5 a lot of new elements, but is to make it easier for us to make more beautiful pages out, now let's take a look at the following I introduce this kind of element bar
HTML5 Canvas
Last modified August 01, 2017
Labels define graphs, tables, and other images, and you must use scripts to draw graphics.
Draw a red rectangle on the
Welcome to the HTML5 canvas (canvas) Practical Programming Starter Series, in this series, we will introduce the simplest HTML5 canvas programming. Including:
Canvas elements
Draw a line
Drawing curves
Draw Path
3D ship effects generated by HTML5 canvas, html5 canvas 3d ship
Online Demo
Local download
Use HTML5 canvas 2D to simulate 3D space effects, generate fleet flight effects, and learn how to develop them. Please read the follow
HTML5 canvas (rectangle), html5 canvas rectangle
The canvas element is used to draw a graph.
The canvas element is an important new element in HTML5. The element itself is not capable o
Simple implementation of graffiti Html5 write your own canvas, html5 canvas
I recently learned that I was amazed by html5's powerful drawing function. So I wrote a little theme: Graffiti board. The following functions can be implemented: painting, color change, and paint bru
Turn from: https://software.intel.com/zh-cn/blogs/2014/05/20/html5-canvas-html5/?utm_campaign=CSDNutm_source= Intel.csdn.netutm_medium=linkutm_content=%20others-%20canvas
The light rose that. In Tuesday, 20/05/2014-00:55 submitted
In the HTML5 can use the canvas tag on the
Starting from today, we will begin a series of courses on HTML5 canvas. This series is my summary after reading HTML5 canvas: Native interactivity and animation for the Web. If you are interested, you can download the original English books and read them. This book introduces canva
HTML5 canvas (image), html5 canvas Image
Case 1:
Note:
(1) Use the drawImage method to draw an image:
Method 1: cxt. drawImage (image, x, y );
An image is an Image object that is used to load image files. X and y are the starting coordinates of the image in the canvas
HTML5 canvas (deformation), html5 canvas Deformation
Coordinate Transformation
Case 1:
Note:
(1) Translation
Cxt. translate (x, y );
The translate method uses two parameters. x indicates the number of units to move the axis origin point to the left. The default value is pixel, and y indicates the number of
HTML5 canvas (line, gradient), html5 canvas line gradient
When drawing a straight line, the moveTo and lineTo methods are generally used.
Case 1:
Note:
(1) moveTo (x, y );
This method is used to move the cursor to the specified coordinate point. When a straight line is drawn, this coordinate point is used
HTML5 canvas (Shadow), html5 canvas shadow
Case 1:
Note:(1) shadowOffsetX: the horizontal displacement of the shadow, that is, the distance from the horizontal movement of the image;ShadowOffsetY: the vertical displacement of the shadow, that is, the distance from the vertical direction;ShadowColor-the sh
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.