Skip to content

Instantly share code, notes, and snippets.

@HelloWorld017
Last active October 15, 2016 05:34
Show Gist options
  • Save HelloWorld017/2fc07e6954192a93bd942bc608478505 to your computer and use it in GitHub Desktop.
Save HelloWorld017/2fc07e6954192a93bd942bc608478505 to your computer and use it in GitHub Desktop.
Scripts which are used to create loading animation
create = (r, r2, cx, cy, className) => {
str = '';
for(let _angle = 0; _angle < 360; _angle += 30){
angle = _angle * Math.PI / 180;
let cos = Math.cos(angle);
let sin = Math.sin(angle);
str += `<line x1="${Math.round(cx + cos * r)}" y1="${Math.round(cy + sin * r)}" x2="${Math.round(cx + cos * r2)}" y2="${Math.round(cy + sin * r2)}" class="line-outer ${className}"/>\n`;
}
console.log(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment