Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <body>
<!-- uses jquery and gsap -->
<!-- these are verrrrrrry basic particles but look fine if you just need a quick effect. The parameters allow for a 'little' customisation. The particles are created dynamically as HTML elements.
Jquery is not required here really.
For a more comprehensive particle system I would use canvas as my base and create it that way --> 
<!-- clean up is very important with particles and this does not address that here -->
  <image=''></image>
<img id="banner" src="http://www.gingerman.co.uk/img/gingerman_email_sig_big.png" alt="gingerman"></img>
<p id='title1'>Quick and Dirty Particles - v1 - refresh page to see effect.</p>
<p id='particleContainer'></p>

</body>
              
            
!

CSS

              
                body {
	background-color: #ff0000;
  margin:0px;
  padding:0px;
  border:0px;
  
}
#particleContainer{
  position: absolute;
  left:0px;
  top:0px;
  width:100%;
  height:100%;  
}
.particle {
	font-size: 300px;
	font-family: "arial", sans-serif;
	position: absolute;
	visibility: hidden;
}
#banner{
  position: absolute;
  left:0px;
  top:0px;
  width:100%;
  height:auto;
  opacity:0.1;
  mix-blend-mode: darken;
}
#title1{
position: absolute;
  left:10px;
  top:10px;
}
              
            
!

JS

              
                // this is very quick and dirty 
// usually I would opt for a more Object Oriented Clas based approach, but this is fine and lightweight for a quick effect

var density = 80;
var speed = 6;

var particleStartY = 1;//$(window).height()/2;
var particleStartX = $(this).width()/2;

var start = {yMin:particleStartY - 10,  yMax:particleStartY + 10,  xMin:particleStartX - 10, xMax:particleStartX + 10, scaleMin:0.1, scaleMax:0.2, opacityMin:0.2,  opacityMax:0.4};
var mid =   {yMin:particleStartY - 60, yMax:particleStartY + 60,   xMin:particleStartX - 15, xMax:particleStartX + 10, scaleMin:0.2, scaleMax:0.4,   opacityMin:0.15, opacityMax:0.2};
var end =   {yMin:particleStartY - 50,  yMax:particleStartY + 50,  xMin:particleStartX - 50, xMax:particleStartX + 50, scaleMin:0.4, scaleMax:0.3, opacityMin:0,    opacityMax:0.6};
var colors = ["#ffEEff","#ee00ee","#fafafa","#fafaf1","#efefef"];

	function range(map, prop) {
		var min = map[prop + "Min"],
			max = map[prop + "Max"];
		return min + (max - min) * Math.random();
	}

	function spawn(particle) {
		var wholeDuration = (10 / speed) * (0.7 + Math.random() * 0.4),
			delay = wholeDuration * Math.random(),
			partialDuration = (wholeDuration + 1) * (0.3 + Math.random() * 0.4);

		//set the starting values
		TweenLite.set(particle, {y:range(start, "y"), x:range(start, "x"), scale:range(start, "scale"), opacity:range(start, "opacity"), visibility:"hidden", color:colors[ Math.floor(Math.random() * colors.length) ]});

		//the y tween should be continuous and smooth the whole duration
		TweenLite.to(particle, wholeDuration, {delay:delay, y:range(end, "y"), ease:Linear.easeNone});

		//now tween the x independently so that it looks more randomized (rather than linking it with scale/opacity changes too)
		TweenLite.to(particle, partialDuration, {delay:delay, x:range(mid, "x"), ease:Power1.easeOut});
		TweenLite.to(particle, wholeDuration - partialDuration, {delay:partialDuration + delay, x:range(end, "x"), ease:Power1.easeIn});

		//now create some random scale and opacity changes
		partialDuration = wholeDuration * (0.5 + Math.random() * 0.3);
		TweenLite.to(particle, partialDuration, {delay:delay, scale:range(mid, "scale"), autoAlpha:range(mid, "opacity"), ease:Linear.easeNone});
		TweenLite.to(particle, wholeDuration - partialDuration, 
			{delay:partialDuration + delay, scale:range(end, "scale"), autoAlpha:range(end, "opacity"), ease:Linear.easeNone , onComplete:killparticle, onCompleteParams:[particle]}); // 
	}

	function killparticle( particle){

		TweenLite.to(particle, 0.2, {opacity:0 });


	}

	$(window).ready(function() {
		var body = $("#particleContainer"),
			i, particle;
		for (i = 0; i < density; i++) {
			spawn( $("<div />", {id:"particle"+i}).addClass("particle").text( "•" ).appendTo(body) );
		}
	});
              
            
!
999px

Console