<!--
###########################################################################################
This is a JSFiddle example of "Cacatoo". This HTML page does not contain the code itself,
but determines where the grids, graphs, buttons, etc are placed. The real code is in the
Javascript Tab. I recommend enabling "Tabs (Columns)" under the settings in the top-right.
###########################################################################################
-->
<html>
<script src="https://bramvandijk88.github.io/cacatoo/scripts/cacatoo.js"></script>
<script src="https://bramvandijk88.github.io/cacatoo/scripts/all.js"></script>
<head>
<title>Cacatoo examples</title>
</head>
<script>
/*-------------------------End user-defined code ---------------------*/
</script>
<body onload="cacatoo()">
<div class="", id="all_holder">
<div class="content" id="canvas_holder"> </div>
<div class="content" id="graph_holder"> </div>
<div class="content" id="form_holder"></div>
</div>
</body>
</html>
/*-----------------------Start user-defined code ---------------------*/
let sim;
dAh = 0.8
dAv = 1.5
dIh = 1.5
dIv = 1
function cacatoo() {
let config = {
title: "Striped Turing patterns",
description: "\"The stripes are easy, but what about the horse part?<br>(use mouse/touch to bleach the stripes)",
maxtime: 10000,
ncol: 600,
nrow: 200, // dimensions of the grid to build
wrap: [true, true], // Wrap boundary [COLS, ROWS]
scale: 1, // scale of the grid (nxn pixels per grid cell
show_gridname: true,
graph_interval: 5,
graph_update: 20,
printcursor: false,
bgcolour: 'white'
}
sim = new Simulation(config)
sim.makeGridmodel("turing")
sim.turing.colourGradient("activator", 200,[255,255,255], [0,0,0])
sim.createDisplay_continuous({model:"turing", property:"activator", legend:false, label:"\"The stripes are easy.\"", // Createa a display for a continuous variable (ODE state for external resources)
minval:0.0, maxval:1.0, num_colours:200, decimals: 2})
let act = 0.5
let inh = 0.5
let d = 0.05
// Initialise the left 3 cols with activator and inhibitor
for (let x = 0; x < sim.turing.nc; x++)
for (let y = 0; y < sim.turing.nr; y++)
{
sim.turing.grid[x][y].activator = 0.1 + 0.1*sim.rng.genrand_real1()
sim.turing.grid[x][y].inhibitor = 0
}
sim.turing.kernelA = Simulation.makeGaussianKernel(dAh, dAv) // 2 variable = 2D kernel with sigma_x=0.75, sigma_y=1.0
sim.turing.kernelI = Simulation.makeGaussianKernel(dIh, dIv)
console.log(sim.turing.kernelA)
console.log(sim.turing.kernelI)
sim.turing.nextState = function (x, y) // Define the next-state function.
{
let thisgp = this.grid[x][y]
let gp = thisgp //this.getNeighbour(this,x,y,1) // grid[x][y]
let act_new = gp.activator + (act * gp.activator - inh *...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.