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 c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var mask; var pointCount = 500; var str = "Hello."; var fontStr = "bold 128pt Helvetica Neue, Helvetica, Arial, sans-serif"; ctx.font = fontStr; ctx.textAlign = "center"; c.width = ctx.measureText(str).width; c.height = 128; // Set to font size var whitePixels = []; var points = []; var point = function(x,y,vx,vy){ this.x = x; this.y = y; this.vx = vx || 1; this.vy = vy || 1; } point.prototype.update = function() { ctx.beginPath(); ctx.fillStyle = "#95a5a6"; ctx.arc(this.x,this.y,1,0,2*Math.PI); ctx.fill(); ctx.closePath(); // Change direction if running into black pixel if (this.x+this.vx >= c.width || this.x+this.vx < 0 || mask.data[coordsToI(this.x+this.vx, this.y, mask.width)] != 255) { this.vx *= -1; this.x += this.vx*2; } if (this.y+this.vy >= c.height || this.y+this.vy < 0 || mask.data[coordsToI(this.x, this.y+this.vy, mask.width)] != 255) { this.vy *= -1; this.y += this.vy*2; } for (var k = 0, m = points.length; k
CSS
html { background:#ecf0f1; } canvas { display:block; margin:auto; background:#ecf0f1; }
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