Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              body {
  background-color:#111;
  overflow: hidden;
 // display: flex;
 // align-items: center;
 // justify-content: center; 
  font-family: Kanit, sans-serif;
}

body,
html {
 height: 100%;
 width: 100%;
 margin: 0;
 padding: 0;
}

#demo{
	overflow:hidden;
	width:800px;
	height:350px;
	visibility:hidden;
	position:relative;
	
}
#text {
	width:300px;
	margin-top:-50px;
	position:relative;
}
h1 {
	position:relative;
	color:white;
	font-size:70px;
	font-weight:400;
   margin-top:10px;
	width:300px;
	color:#ccc;
	display:inline-block;
	font-family:kanit;
	font-style:italic;
	font-weight:500;
}

img {margin-top:100px;position:relative;}

.star {
	width:10px;
	height:2px;
	background:#ff6600;
	position:absolute;
	top:0;
}

#soon{
	width:800px;
	position:absolute;
	line-height:350px;
	text-align:center;
	color:white;
	font-size:80px;
	font-weight:500;
	visibility:hidden;
}
            
          
!
            
              // set up PIXI //
let width = window.innerWidth;
let height = window.innerHeight;

let particles = [];

let app = new PIXI.Application({
	width: width, // default: 800
	height: width, // default: 600
	antialias: true, // default: false
	transparent: false, // default: false
	resolution: 1, // default: 1
	backgroundColor: 0x230716
});

let count = 0;
let max = 60;
let timer = gsap.to({}, { onComplete: placeEmitter, duration: 0.08});
let colors = [0xff3399, 0xffffff, 0x6666ff, 0x33ffff];

gsap.set(app.stage, { pixi: { blurX: 2, blurY: 2 } });




document.body.appendChild(app.view);

class Emitter extends PIXI.Container {
	constructor(numCircles, color) {
		super();
		this.animation = gsap.timeline();
		this.circles = [];
		this.containers = [];
		this.startX = 70;
		for (let i = 0; i < numCircles; i++) {
			let container = new PIXI.Container();
			let circle = new PIXI.Graphics();
			circle.beginFill(color);
			circle.drawCircle(0, 0, 2);
			circle.pivot.x = 0;
			circle.pivot.y = 0;
			circle.endFill();
			container.x = this.startX;
			this.containers.push(container);
			this.circles.push(circle);
			container.addChild(circle);
			this.addChild(container);
		}
		var distributor = gsap.utils.distribute({
			base: 0,
			amount: 500,
			from: "default",
			ease: "power2.in"
		});
		let xDistance = gsap.utils.distribute({
			base: 0,
			amount: 800,
			ease: "power1.out"
		});

		let scale = gsap.utils.distribute({
			base: 1.2,
			amount: 15,
			ease: "power1.in"
		});

		gsap.set(this.circles, { x: distributor, pixi: { scale: scale } });

		this.animation
			.from(this.circles, {
				alpha: 0,
				pixi: { scale: 0.1 },
				duration: 0.8,
				stagger: { each: 0.08 }
			})
			.to(
				this.containers,
				{
					x: function(index, element, target) {
						return "+=" + xDistance(index, element, target);
					},
					duration: 7,
					ease: "linear"
				},
				0
			)

			.to(
				this.circles,
				{ alpha: 0, duration: 5, pixi: { scale: 0 }, ease: "power2" },
				"-=5"
			)
			.pause();
	}
}




function weightedRandom(collection, ease) {
	return gsap.utils.pipe(
		Math.random, //random number between 0 and 1
		gsap.parseEase(ease), //apply the ease
		gsap.utils.mapRange(0, 1, 0, collection.length - 1), //map to the index range of the array
		gsap.utils.snap(1), //snap to the closest integer
		i => collection[i] //return that element from the array
	);
}

// usage:
var getRandom = weightedRandom(colors, "power2.in");

for (var n = 0; n < max; n++) {
	let e = new Emitter(gsap.utils.random(16, 24), getRandom());
	particles.push(e);
}

var rotation = 0;

function placeEmitter() {
	let e = app.stage.addChild(particles[count % particles.length]);
	e.y = height / 2;
	e.x = width / 2;
	e.animation.restart();
	gsap.set(e, { pixi: { rotation: (rotation += gsap.utils.random(10, 14)) } });
	count++;
	//if (count < 1000) {
		timer.restart();
	//}
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console