Personal tools
Make a donation
$ 




Javascript blobs

From OrganicDesign Wiki

Jump to: navigation, search
<html>
<head>
<style type='text/css'>
body { background-color: black; }
</style>
<script type='text/javascript' src='raphael.js'></script> 
</head>
<body >
<div id='canvas'>
Hello world!
</div>



<script type='text/javascript'>
var n = 10;
var objects = [];
var scale = 1;
	var paper = Raphael(0, 0, 1280, 1024);
for(var i = 0; i < n; i++) {
	objects[i] = paper.circle( 50, i * 50, 20);
	objects[i].attr("fill", "#3a2");
	objects[i].attr("stroke", "#fff");
	objects[i].attr("stroke-width", 2);
	}
	
var update = function() {
for(var i; i < n; i++) {
	// position
	
	objects[i].attr({x: += .vx * scale;
	objects[i].y += objects[i].vy * scale;
	// velocity
	
	}
	
}

setTimeout ( update, 100 );

</script>
</body>
</html>

The GNU Project Debian Linux Ubuntu Linux Wikipedia Affiliate Button MediaWiki

Content under the www.organicdesign.co.nz domain is available under the Creative Commons Attribution-ShareAlike License