Coral Polyp Growth
Anthozoan coral colony morphology simulated through differential boundary growth equations and undulating feather tentacle radial symmetry.
60 FPS • Canvas 2D
Click + Drag to interact with field
</>
Full Executable Algorithm Code
106 lines
3749 chars
// 034 - Coral Polyp Growth (botany)
// 1:1 Original algorithm engine source
function createCoralPolypGrowth() {
const POLYP_COUNT = 8;
const TENTACLES_PER_POLYP = 12;
return {
setup() {
},
render(context, timeState, params) {
const { ctx, width, height } = context;
const speed = Number(params.flowSpeed || 0.8);
const bloomScale = Number(params.bloomScale || 1.1);
const t = timeState.time * speed;
ctx.fillStyle = "#06080e";
ctx.fillRect(0, 0, width, height);
const cx = width * 0.5;
const cy = height * 0.52;
const baseR = Math.min(width, height) * 0.28;
ctx.beginPath();
const ridgeSteps = 120;
for (let i = 0; i <= ridgeSteps; i++) {
const phi = i / ridgeSteps * Math.PI * 2;
const bump = Math.sin(phi * 6 + t * 0.5) * 12 + Math.cos(phi * 12 - t) * 6;
const r = (baseR * 0.6 + bump) * bloomScale;
const px = cx + Math.cos(phi) * r;
const py = cy + Math.sin(phi) * r;
if (i === 0) ctx.moveTo(px, py);
else ctx.lineTo(px, py);
}
ctx.closePath();
ctx.fillStyle = hsla(330, 85, 45, 0.4);
ctx.fill();
ctx.strokeStyle = hsla(340, 95, 70, 0.8);
ctx.lineWidth = 2.2;
ctx.stroke();
for (let p = 0; p < POLYP_COUNT; p++) {
const polypAngle = p / POLYP_COUNT * Math.PI * 2 + t * 0.1;
const polypDist = baseR * (0.8 + 0.15 * Math.sin(t * 1.5 + p));
const px = cx + Math.cos(polypAngle) * polypDist;
const py = cy + Math.sin(polypAngle) * polypDist;
ctx.beginPath();
ctx.arc(px, py, 6 * bloomScale, 0, Math.PI * 2);
ctx.fillStyle = hsla(50, 95, 75, 0.95);
ctx.fill();
for (let k = 0; k < TENTACLES_PER_POLYP; k++) {
const tentAngle = k / TENTACLES_PER_POLYP * Math.PI * 2;
const tentLen = (28 + Math.sin(t * 3 + p + k) * 8) * bloomScale;
ctx.beginPath();
ctx.moveTo(px, py);
const wavePhase = t * 4 + k * 0.5 + p;
const ctrlX = px + Math.cos(tentAngle) * (tentLen * 0.5) + Math.sin(wavePhase) * 6;
const ctrlY = py + Math.sin(tentAngle) * (tentLen * 0.5) + Math.cos(wavePhase) * 6;
const endX = px + Math.cos(tentAngle) * tentLen;
const endY = py + Math.sin(tentAngle) * tentLen;
ctx.quadraticCurveTo(ctrlX, ctrlY, endX, endY);
const tentHue = (320 + p * 15 + k * 4) % 360;
ctx.strokeStyle = hsla(tentHue, 95, 72, 0.85);
ctx.lineWidth = 1.4;
ctx.stroke();
}
}
}
};
}
// Default parameters from content metadata
const defaultParams = [
{
"key": "flowSpeed",
"label": "Tidal Wave Flow",
"type": "range",
"min": 0.3,
"max": 2.5,
"step": 0.1,
"defaultValue": 0.8,
"description": "Tentacle wave oscillation rate"
},
{
"key": "bloomScale",
"label": "Colony Expansion",
"type": "range",
"min": 0.6,
"max": 1.6,
"step": 0.1,
"defaultValue": 1.1,
"description": "Radial polyp size multiplier"
}
];
if (!window.__art_instances) window.__art_instances = {};
if (!window.__art_instances['coral-polyp-growth']) {
const inst = typeof createCoralPolypGrowth === 'function' ? createCoralPolypGrowth() : null;
if (inst && inst.setup) {
inst.setup({ ctx, width, height, dpr: 1, aspectRatio: width / height }, defaultParams);
}
window.__art_instances['coral-polyp-growth'] = inst;
}
const instance = window.__art_instances['coral-polyp-growth'];
if (instance && instance.render) {
instance.render(
{ ctx, width, height, dpr: 1, aspectRatio: width / height },
{ time, deltaTime: dt, frameCount: Math.floor(time * 60), fps: 60 },
defaultParams
);
} Edit in Interactive Playground
Zero Dependencies • Standalone Canvas 2D
ƒ
Mathematical Formulation
medium
Analytical Equation
p(θ,t)=[R0+m=1∑KAmsin(mθ+ωmt)][cosθsinθ]
Click to expand
∑
Coral Polyp Growth
Full Mathematical System • botany
100%
Complete System of Equations
[Governing Law][Discrete Progression]theta+0.5t)+6cos(12theta−t),tentacle=quadCurve(mouth,ctrlWave,tip)[Domain & Space][Parameter State]p(θ,t)=[R0+m=1∑KAmsin(mθ+ωmt)][cosθsinθ]rridge=R0+12sin(6x∈R2,t∈R+,ω∈[0,2π]λflowSpeed=0.8(Tidal Wave Flow),λbloomScale=1.1(Colony Expansion)
p(θ,t)=[R0+m=1∑KAmsin(mθ+ωmt)][cosθsinθ]
Computational Implementation (JavaScript Engine Equivalent)
r_ridge = R0 + 12 sin(6θ + 0.5t) + 6 cos(12θ - t), tentacle = quadCurve(mouth, ctrlWave, tip) Compact Formula
r_ridge = R0 + 12 sin(6θ + 0.5t) + 6 cos(12θ - t), tentacle = quadCurve(mouth, ctrlWave, tip) Mathematical Tags
#coral
#polyps
#differential-growth
#botany
#marine
#nature
Author: Math Art Core Target: 60 FPS
Press ESC or F to exit