Loading...
(function(){<br />
let canvas = document.createElement('canvas'),<br />
ctx = canvas.getContext('2d'),<br />
w = canvas.width = innerWidth,<br />
h = canvas.height = innerHeight,<br />
particles = [],<br />
properties = {<br />
bgColor : 'rgba(17, 17, 19, 1)',<br />
particleColor : 'rgba(255, 40, 40, 1)',<br />
particleRadius : 3,<br />
particleCount : 60,<br />
particleMaxVelocity : 0.5,<br />
lineLength : 150,<br />
particleLife : 6,<br />
};<br />
<br />
document.querySelector('body').appendChild(canvas);<br />
<br />
window.onresize = function() {<br />
w = canvas.width = innerWidth;<br />
h = canvas.height = innerHeight;<br />
}<br />
<br />
class Particle {<br />
constructor() {<br />
this.x = Math.random()*w;<br />Loading...
If you want to enable smooth scrolling of the page (for example, when navigating via anchor links), you can add the scroll-behavior: smooth property to the scrollable element.
1.scroll {2 scroll-behavior: smooth;3}
Window.scrollTo() and element.scrollIntoView()
Both window.scrollTo() and element.scrollIntoView() support a behavior option that allows you to enable smooth scrolling.
1//Window.scrollTo()2window.scrollTo({3 top: 0,4 left: 0,5 behavior: "smooth",6});78//element.scrollIntoView()9сontainer.scrollIntoView({10 block: "start",11 behavior: "smooth",12});