<!--
###########################################################################################
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> <!-- Dependencies
<link rel="stylesheet" href="style.css"> <!-- Set style sheet -->
<head>
<title>Cacatoo examples</title>
</head>
<script>
/*-------------------------End user-defined code ---------------------*/
</script>
<body onload="cacatoo()">
<div class="content" id="canvas_holder"> </div>
<div class="content" id="form_holder"> </div>
</body>
</html>
/*-----------------------Start user-defined code ---------------------*/
let sim;
// Define global parameters
let num_colours = 6
let dots_per_colour = 100
let movement_rate = 0.0003 // Control the influence of the attraction/repulsion
let self_attraction_rate = 0.0005 // Mild attraction to same color
let repulsion_distance = 3.5 // distance for repulsion
function cacatoo() {
let simconfig = {
title: "Particle life", // The name of your cacatoo-simulation
description: "", // And a description if you wish
maxtime: 50000, // How many time steps the model continues to run
// (note, the onscreen FPS may drop below 60 fps when using fast mode, although many more timesteps may be handled per second)
width: 200, // Number of columns (width of your grid)
height: 150, // Number of rows (height of your grid)
scale: 2.5, // Scale of the grid (nxn pixels per grid point)
sleep: 0,
seed: 5,
wrap: [true,true],
//fpsmeter: true,
bgcolour: "#151515",
statecolours: {
'type': { 1: '#E40303',
2: '#FF8C00',
3: '#FFED00',
4: '#008026',
5: '#24408E',
6: '#732982'
}
},
}
let flockconfig = {
shape: 'dot', // Shape of the boids drawn
click: 'repel', // Clicking the boids pushes them away from the mouse
max_speed: 1, // Maximum velocity of boids
max_force: 1, // Maximum steering force applied to boids (separation/cohesion/alignment rules)
init_velocity:0.0,
friction: 0.2,
brownian: 0.0,
gravity: 0.0,
// Mouse parameters
mouse_radius: 20, // Radius of boids captured by the mouse overlay
draw_mouse_radius: true, // Show a circle where the mouse is
// Collision behaviour
collision_force: 0.03,
separation: {strength:0.3,radius:5},
size: 1.5, // Size of the boids (scales...
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.