Snap SVG exploration

Developer
Size
3,250 Kb
Views
14,168

How do I make an snap svg exploration?

The stars in this project are not my invention! I borrowed from another pen and altered to fit. This is called out in the code. . What is a snap svg exploration? How do you make a snap svg exploration? This script and codes were developed by Aaron Happe on 09 November 2022, Wednesday.

Snap SVG exploration Previews

Snap SVG exploration - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Snap SVG exploration </title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <body>
<div class="svg-wrap" id="svg-wrap">
<a href="#">CLICK ON THE DAMN SUN! :D</a>
<div class="css-circle" id="space">	<div class="stars"></div> <div class="stars"></div> <div class="stars"></div> <div class="stars"></div> <div class="stars"></div>
</div>	<svg id="svg" width="100%" height="100%" viewBox="0 0 600 600" >	</svg>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.3.0/snap.svg-min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Snap SVG exploration - Script Codes CSS Codes

body { font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; font-weight: 300;
background: rgba(33,180,226,1);
background: -moz-linear-gradient(top, rgba(33,180,226,1) 0%, rgba(33,180,226,1) 1%, rgba(113,206,239,1) 56%, rgba(183,222,237,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(33,180,226,1)), color-stop(1%, rgba(33,180,226,1)), color-stop(56%, rgba(113,206,239,1)), color-stop(100%, rgba(183,222,237,1)));
background: -webkit-linear-gradient(top, rgba(33,180,226,1) 0%, rgba(33,180,226,1) 1%, rgba(113,206,239,1) 56%, rgba(183,222,237,1) 100%);
background: -o-linear-gradient(top, rgba(33,180,226,1) 0%, rgba(33,180,226,1) 1%, rgba(113,206,239,1) 56%, rgba(183,222,237,1) 100%);
background: -ms-linear-gradient(top, rgba(33,180,226,1) 0%, rgba(33,180,226,1) 1%, rgba(113,206,239,1) 56%, rgba(183,222,237,1) 100%);
background: linear-gradient(to bottom, rgba(33,180,226,1) 0%, rgba(33,180,226,1) 1%, rgba(113,206,239,1) 56%, rgba(183,222,237,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#21b4e2', endColorstr='#b7deed', GradientType=0 );
}	#svg {	position: relative;	z-index: 2;	}	#svg circle {	cursor: pointer;	}	.svg-wrap {	position: relative;	height: 600px;	max-width: 600px;	margin: 0 auto;	}	.svg-wrap a {	display: block;	color: #000;	font-weight: bold;	text-align: center;	margin-top: 2em;	}	.svg-wrap a:hover {	color: #d76327;	}	.css-circle {	position: absolute;	border-radius: 50%;	width: 380px;	height: 380px;	top: 126px;	left: 110px;	background-color: black;	z-index: 1;	}
/* Stars
this portion borrowed from: https://codepen.io/keithclark/pen/zqcEd
------------------------------------- */
#space, .stars { overflow: hidden; border-radius: 50%;	width: 380px;	height: 380px;	position: absolute;
}
.stars { background-image: radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)), radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)), radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)), radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)), radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)), radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0)); background-repeat: repeat; background-size: 200px 200px; -webkit-animation: zoom 5s infinite; opacity: 0; color: #fff;
}
.stars:nth-child(1) { background-position: 50% 50%; animation-delay: 0s; -webkit-animation-delay: 0s;
}
.stars:nth-child(2) { background-position: 20% 60%; animation-delay: 1s; -webkit-animation-delay: 1s;
}
.stars:nth-child(3) { background-position: -20% -30%; animation-delay: 2s; -webkit-animation-delay: 2s;
}
.stars:nth-child(4) { background-position: 40% 80%; animation-delay: 3s; -webkit-animation-delay: 3s;
}
.stars:nth-child(5) { background-position: -20% 30%; animation-delay: 4s; -webkit-animation-delay: 4s;
}
@-webkit-keyframes zoom { 0% { opacity: 0; -webkit-transform: scale(.5); -webkit-animation-timing-function: ease-in; } 75% { opacity: 1; -webkit-transform: scale(1.2); -webkit-animation-timing-function: linear; } 100% { opacity: 0; -webkit-transform: scale(1.8); }
}

Snap SVG exploration - Script Codes JS Codes

/*all this code is a *damn* mess! trust! I will be cleaning it up*/
var s = Snap(document.querySelector( 'svg' ));
var bigCircle = s.circle(300, 300, 200);
var p = s.circle(10, 10, 5).attr({	fill: "none",	stroke: "#bada55",	strokeWidth: 5
})
p = p.pattern(0, 0, 25, 25);
bigCircle.attr({	fill: "r()#d76227-#e29028",
});
// var discs = s.group(smallCircle1, smallCircle2);
// var smallCircArray = [smallCircle1, smallCircle2];
// smallCircArray.forEach(function(element, index){
//	element.animate({r:75}, 1000);
// });
var wrap = document.getElementById('svg-wrap');	wrap.classList.add("not-clicked");
var ocill = function() {	if (wrap.classList.contains("not-clicked")) {	bigCircle.stop().animate({r:202}, Math.random() * 2, mina.easeout, function() {	bigCircle.stop().animate({r:200}, Math.random() * 2, mina.elastic);	});	}
};
window.setInterval(ocill, 20);
bigCircle.node.onclick = function () {	if(wrap.classList.contains("not-clicked")){	bigCircle.stop().animate({r:0}, 1000, mina.elastic);	wrap.classList.remove("not-clicked");	} else {	bigCircle.stop().animate({r:200}, 1000, mina.elastic);	wrap.classList.add("not-clicked");	}
}
// bigCircle.classList.add('cool');
// bigCircle.node.onclick = function () {
//	if(this.classList.contains('cool')) {
//	//	bigCircle.stop().animate({r:75}, 1000, mina.elastic)
//	// }
//	alert('cool!');
// }
Snap SVG exploration - Script Codes
Snap SVG exploration - Script Codes
Home Page Home
Developer Aaron Happe
Username aaronhappe
Uploaded November 09, 2022
Rating 3
Size 3,250 Kb
Views 14,168
Do you need developer help for Snap SVG exploration?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Aaron Happe (aaronhappe) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!