Topic: Metaballs, Canvas, low fps |
|
|---|---|
| Author | Thread |
|
Obsessive-Compulsive (I) Inmate From: Cracow, Poland |
posted 01-06-2009 00:59
Hello |
|
Paranoid (IV) Inmate From: Norway |
posted 01-06-2009 02:42
128x128 is an awful lot of pixels to draw and compute manually. |
|
Obsessive-Compulsive (I) Inmate From: |
posted 01-07-2009 01:17
I can't offer much help with the data:URI or much else, but I know the imageData approach would be a lot faster. code: <html>
<body>
<canvas id="canvas" width="128" height="128"></canvas>
<script>
var context = document.getElementById('canvas').getContext('2d');
var imgData = context.getImageData(0, 0, context.canvas.width, context.canvas.height);
var r = Math.floor(Math.random() * 255);
var g = Math.floor(Math.random() * 255);
var b = Math.floor(Math.random() * 255);
var a = Math.floor(Math.random() * 255);
var data = imgData.data;
var len = data.length;
var index = 0;
while (index < len) {
data[index++] = r;
data[index++] = g;
data[index++] = b;
data[index++] = a;
}
context.putImageData(imgData, 0, 0);
</script>
</body>
</html>
|
|
Paranoid (IV) Inmate From: Norway |
posted 01-07-2009 11:02
As you obviously figured already by doing adaptive subsampling, such effect is a perfect candidate to render/process at lower resolution then strecth & blur. I really doubt you need to process 128x128 pixels. |
|
Obsessive-Compulsive (I) Inmate From: |
posted 03-21-2009 01:44
I'm a newbie to using <CANVAS>, but I think radial gradients in larger rectangles might work well. You'd just set the gradient colors so that the gradient is a white radial gradient whose alpha decreases as it goes outward. Now, there'd be the flaw of how the balls look when they merge: |
|
Nervous Wreck (II) Inmate From: |
posted 05-31-2011 11:08
Edit TP: spam removed
|