Skip to content

Instantly share code, notes, and snippets.

@navin-moorthy
Last active February 7, 2020 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navin-moorthy/d1571fde39982879ef7021f418178444 to your computer and use it in GitHub Desktop.
Save navin-moorthy/d1571fde39982879ef7021f418178444 to your computer and use it in GitHub Desktop.
CloneCSS-GASP SpeedLines
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 600 600">
<g class="speedLines">
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
<line x1="0" y1="0" x2="0" y2="0"></line>
</g>
</svg>
{
"scripts": [
"https://cdnjs.cloudflare.com/ajax/libs/gsap/3.0.5/gsap.min.js"
],
"styles": []
}
const colorArray = ["violet", "blue", "green", "yellow", "red", "orange", "white", "pink"];
gsap
.fromTo(
".speedLines line",
{
attr: {
y1: 0,
y2: "random(20, 200)"
},
x: "random(0, 600)",
y: -200,
stroke: gsap.utils.wrap(colorArray)
},
{
duration: "random(0.2, 0.6)",
y: 600,
ease: "none",
stagger: {
each: 0.2,
repeat: -1,
repeatRefresh: true
}
}
)
.seek(100);
@import url("https://fonts.googleapis.com/cssfamily=Montserrat:400,700&display=swap");
* {
box-sizing: border-box;
}
body {
height: 100vh;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #1d1d1d;
display: grid;
place-items: center;
font-family: Montserrat;
}
.svg {
width: 100%;
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment