Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Wave effect Map by html5

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces html5 how to achieve wave effect map related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this html5 how to achieve wave effect map article will have a harvest, let's take a look at it.

First draw a simple circle to make a new shake straight microcircle.

Var ctx = document.getElementById ('myCanvas'). GetContext (' 2d')

Ctx.lineWidth = 1

Ctx.strokeStyle = "orange"

Ctx.arc (100, 100, 100, 90, 0, 10, 7, 2, 9, 9, 2, 9, 2, 9, 2, 9, 2, 9, 2, 4, 2, 4, 2, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,

Ctx.stroke ()

Rolling up and down in the circle is the line that direct friends can read and move.

Var ctx = document.getElementById ('myCanvas'). GetContext (' 2d')

Var y = 100

Var flag = 0

Function init () {

/ / clear canvas

Ctx.clearRect (0Pol 0200200)

/ / calculate the corresponding x value as the y value moves up and down on the left semicircle

/ / var y = 30

Var expression = 8100-Math.pow ((100mury), 2)

Var x = 100-Math.sqrt (expression)

Ctx.beginPath ()

Ctx.lineWidth = 1

Ctx.strokeStyle = "orange"

Ctx.arc (100, 100, 100, 90, 0, 10, 7, 2, 9, 9, 2, 9, 2, 9, 2, 9, 2, 9, 2, 4, 2, 4, 2, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,

Ctx.stroke ()

Ctx.lineWidth = 1

Ctx.strokeStyle = "green"

Ctx.beginPath ()

Ctx.moveTo (XBI y)

Ctx.lineTo (200murx, y)

Ctx.stroke ()

If (flag = = 0) {

Y + = 1

If (y = = 130) {

Flag = 1

}

} else {

Y-= 1

If (y = = 70) {

Flag = 0

}

}

Window.requestAnimationFrame (init)

}

In the whole process, the simulated water needs more ups and downs than the need to shake friends.

Var ctx = document.getElementById ('myCanvas'). GetContext (' 2d')

Var y = 100

Var flag = 0

Function init () {

/ / clear canvas

Ctx.clearRect (0Pol 0200200)

/ / calculate the corresponding x value as the y value moves up and down on the left semicircle

Var expression = 8100-Math.pow ((100mury), 2)

Var x = 100-Math.sqrt (expression)

Ctx.lineWidth = 1

Ctx.strokeStyle = "green"

Ctx.beginPath ()

Ctx.moveTo (XBI y)

Ctx.lineTo (200murx, y)

Ctx.stroke ()

/ / calculate the point at which the starting point of the circle (the right endpoint of the diameter parallel to the X axis) and the given Y coordinate on the left side of the circle

Var distance = Math.sqrt (Math.pow ((190murx), 2) + Math.pow ((100mury), 2))

/ / sina=d/2r an is half of the angle 2a is the center angle of two points Math.asin the final result is radians such as asin (1) = 1/2*PI

Var angle = Math.asin (distance/180) * 2

Ctx.beginPath ()

If (y)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 236

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report