Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="panel1" class="panel">
		<div id="end_partDivCont" class="partDivCont"></div>
		<div id="end_mainClickTag" class="mainClickTag panel"></div>
	</div>
              
            
!

CSS

              
                .panel {
	width: 900px;
	height: 500px;
	overflow: hidden;
}
#panel1 {
	background-color: #000;
}
#banner div,
#banner img {
	position: absolute;
}

.partDivCont {
	pointer-events: none;
}
.particle {
	position: absolute;
	background: radial-gradient(
		ellipse at center, 
		rgba(241,247,250,1) 0%,
		rgba(241,247,250,.75) 35%,
		rgba(241,247,250,0) 50%);
}
              
            
!

JS

              
                /* = Define vars
-----------------------------------------------------------------------------*/

var end_mainClickTag 	= document.querySelector("#end_mainClickTag");
var end_partDivCont 	= document.querySelector("#end_partDivCont");


/* = FX
-----------------------------------------------------------------------------*/

function particleFx1() {
	createPartsTl
		 (end_partDivCont, // targetDiv
		  -0, 900,	// startX, +startXrand
		  200, 300,	// startY, +startYrand
		  -100, 90,	// angleStart, +angleSpread
		  25, 100	// minDist, +randDist (pixel/sec)
		 );
}

var parts_tl;
function createPartsTl(targetDiv, startX,startXrand, startY,startYrand, angleStart,angleSpread, minDist,randDist) {

	parts_tl = new TimelineMax();

	for (var iPart=0; iPart<300; iPart++) {

		// create div
		var partDiv = document.createElement("div");
		// apply class
		partDiv.className = "particle";
		// append to doc
		targetDiv.appendChild(partDiv);

		// size
		var pWidth = Math.random() * 5+1;
		//var pHeight = Math.random() * 1+2;
		var pScale;
		// make some much larger
		/*if (iPart % 25 === 0)
		{
			pScale = Math.random() * 1 + 3;
		}
		else
		{*/
			pScale = Math.random() * 1.25 +.5;
		/*}*/
		
		// colors
		//var colors = ['#49d6f1', '#fcdb60', '#da3100'];
		//var randomColor = colors[Math.floor(Math.random() * colors.length)];
		
		// start position
		var pX = Math.random() * startXrand +startX;
		var pY = Math.random() * startYrand +startY;
		
		// speed
		var duration = 6;
		var delay = Math.random() * 1; // pause inbetween particles start
		var pVelocity = Math.random() * randDist + minDist; // max distance
		
		// angle
		var pAngle = Math.random() * angleSpread+angleStart;
		//var pAngle = Math.random() < 0.5 ? 90 : 270; // only up or down
		
		// rotation
		var pRot = Math.random() * 360 + 180;
		
		// alpha
		var pAlpha = /*Math.random() * .4 +.3*/1;
		
		// gravity
		var pGravity = 20;

		// start setup
		TweenMax.set(partDiv, {
			x: pX,
			y: pY,
			/*rotation: pAngle,*/ 
			width: pWidth, 
			height: pWidth,
			alpha: 0
			/*backgroundColor: '#ffffff'*/
		});

		// fade in
		parts_tl.to(partDiv, .2, {alpha: pAlpha}, delay);

		// animate position
		parts_tl.to(partDiv, duration, { 
			physics2D:{
				velocity: pVelocity,
				angle: pAngle,
				gravity: pGravity,
			},
			//height: pHeight,
			scale: pScale,
			rotation: pRot
		}, 
					delay);
		
		// fade out
		parts_tl.to(partDiv, .5, {alpha:0, ease:Power0.easeOut}, delay+duration-.5);

	}
	return parts_tl;
}


// addEventListener
end_mainClickTag.addEventListener('mouseover', mainClickTagHandler, false);
function mainClickTagHandler(evt)
{
	particleFx1();
}
              
            
!
999px

Console