Toggle navigation
Sign Up
Log In
Explore
Works
Folders
Tools
Collections
Artists
Groups
Groups
Topics
Tasks
Tasks
Jobs
Teams
Jobs
Recommendation
More Effects...
JS
var w = c.width = window.innerWidth, h = c.height = window.innerHeight, ctx = c.getContext( '2d' ), points = [], frame = 0, repaintAlpha = .04, mouse = { x: 0, y: 0 }; ctx.lineWidth = .1; function anim() { window.requestAnimationFrame( anim ); ctx.fillStyle = 'rgba( 0, 0, 0, alp)'.replace( 'alp', repaintAlpha ); ctx.fillRect( 0, 0, w, h ); ++frame; ctx.translate( w/2, h/2 ); ctx.rotate( frame * .01 ); points.map( function( p ) { p.step() } ); ctx.rotate( -frame * .01 ); ctx.translate( -w/2, -h/2 ); } function Point() { this.reset(); } Point.prototype.reset = function() { this.life = Math.random() * 50 + 20; this.x = Math.random() * w - w/2; this.y = Math.random() * h - h/2; } Point.prototype.step = function() { if( --this.life < 0 ) this.reset(); if( !this.pair ){ var pair = points[ ( Math.random() * points.length ) |0 ], x = pair.x - this.x, y = pair.y - this.y; if( x*x + y*y < 1000 ) { this.pair = pair; } } else { ctx.strokeStyle = 'hsl( hue, 80%, 50% )'.replace( 'hue', this.x / w * 360 + frame % 360 ); ctx.beginPath(); ctx.moveTo( this.x, this.y ); ctx.quadraticCurveTo( mouse.x, mouse.y, this.pair.x, this.pair.y ); ctx.stroke(); } } for( var i = 0; i < 100; ++i ) points.push( new Point ); anim();
CSS
canvas { position: absolute; top: 0; left: 0; background-color: black; }
HTML
Join Effecthub.com
Working with Global Gaming Artists and Developers!
Login
Sign Up
Or Login with Your Email Address:
Email
Password
Remember
Or Sign Up with Your Email Address:
Your Email
This field must contain a valid email
Set Password
Password should be at least 1 character
Stay informed via email