autoplay
This commit is contained in:
parent
d189d59da5
commit
14b7cd1096
18
index.html
18
index.html
|
@ -347,9 +347,9 @@ MY "WHY" FOR MAKING THIS:
|
|||
</words>
|
||||
|
||||
<words id="simple_simple_2">
|
||||
Note: despite the negative name, "contagions" can be good or bad.
|
||||
Note: despite the negative name, "contagions" can be good or bad (or neutral or ambiguous).
|
||||
There's strong statistical evidence<ref id="contagion"></ref> that
|
||||
smoking, happiness, obesity, voting patterns, and cooperation levels
|
||||
smoking, health, happiness, voting patterns, and cooperation levels
|
||||
are all "contagious" --
|
||||
and even some evidence that suicides<ref id="suicides"></ref> and mass shootings<ref id="shootings"></ref> are, too.
|
||||
</words>
|
||||
|
@ -377,10 +377,9 @@ MY "WHY" FOR MAKING THIS:
|
|||
The world's financial institutions fell for such a cascade in 2008.<ref id="subprime"></ref>
|
||||
<br><br>
|
||||
However: <i>this simulation is wrong.</i>
|
||||
Ideas <i>don't</i> spread like viruses.
|
||||
Most ideas <i>don't</i> spread like viruses.
|
||||
For many beliefs and behaviors, you need to be "exposed" to the contagion more than just once
|
||||
in order to be "infected".
|
||||
That is: we have to consider the <i>percentage (%) thresholds</i>.
|
||||
So, network scientists have come up with a new, better way to
|
||||
describe how ideas/behaviors spread, and they call it...
|
||||
<next wiggle>“<i>Complex</i> Contagions!” →</next>
|
||||
|
@ -414,12 +413,12 @@ MY "WHY" FOR MAKING THIS:
|
|||
binge-drinker, that binge-drinker is 50% of their friends. (yeah, they're lonely)
|
||||
In contrast, the person near the end of the chain did <i>not</i> get "infected",
|
||||
because while they were exposed to a binge-drinking friend,
|
||||
they did not exceed the 50%+ majority threshold.
|
||||
they did not pass the 50%+ threshold.
|
||||
|
||||
<div style="height:1em"></div>
|
||||
|
||||
And <i>that's</i> the difference between the <b>"complex contagion"</b> theory,
|
||||
and our earlier, naive, it-simply-spreads-like-a-virus "simple contagion" theory.
|
||||
and our earlier, naive, it-simply-spreads-like-a-virus <b>"simple contagion"</b> theory.
|
||||
|
||||
<div style="height:1em"></div>
|
||||
|
||||
|
@ -829,11 +828,8 @@ MY "WHY" FOR MAKING THIS:
|
|||
<words id="sim_start">
|
||||
> start
|
||||
</words>
|
||||
<words id="sim_next">
|
||||
>> next
|
||||
</words>
|
||||
<words id="sim_reset">
|
||||
↺ reset
|
||||
<words id="sim_stop">
|
||||
[] reset & re-draw
|
||||
</words>
|
||||
|
||||
<!-- - - - - - - - - - - - - -->
|
||||
|
|
|
@ -23,8 +23,8 @@ SLIDES.push(
|
|||
fullscreen: true,
|
||||
network: {
|
||||
"contagion":0.5,
|
||||
"peeps":[[849,356,0],[794,225,0],[543,97,1],[665,147,0],[781,480,0],[906,480,0]],
|
||||
"connections":[[0,1,0],[2,3,0],[3,1,0],[4,0,0],[0,5,0]]
|
||||
"peeps":[[849,356,0],[808,199,0],[543,97,1],[679,114,0],[781,480,0],[906,480,0]],
|
||||
"connections":[[0,1,1],[2,3,1],[3,1,1],[4,0,1],[0,5,1]]
|
||||
},
|
||||
options:{
|
||||
infectedFrame: 2,
|
||||
|
|
|
@ -29,6 +29,12 @@ function ConnectorCutter(config){
|
|||
// IF SANDBOX STATE = PENCIL, complex mouse shtuff
|
||||
if(self.sandbox_state==0){
|
||||
|
||||
// JUST CLICKED & SIM'S RUNNING? STOP
|
||||
if(Simulations.IS_RUNNING && mouse.justPressed){
|
||||
Simulations.IS_RUNNING = false;
|
||||
publish("sim/stop");
|
||||
}
|
||||
|
||||
// only if sim is NOT RUNNING
|
||||
if(!Simulations.IS_RUNNING){
|
||||
|
||||
|
|
|
@ -38,9 +38,26 @@ function Simulations(){
|
|||
|
||||
// Update
|
||||
self.update = function(){
|
||||
|
||||
// Running sims... the CLOCK!
|
||||
if(Simulations.IS_RUNNING){
|
||||
if(self.CLOCK==0){
|
||||
|
||||
// Step all sims!
|
||||
self.sims.forEach(function(sim){
|
||||
sim.nextStep();
|
||||
});
|
||||
self.CLOCK = 30; //25;
|
||||
|
||||
}
|
||||
self.CLOCK--;
|
||||
}
|
||||
|
||||
// Update all sims
|
||||
self.sims.forEach(function(sim){
|
||||
sim.update();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// Draw
|
||||
|
@ -54,33 +71,30 @@ function Simulations(){
|
|||
// SIMULATION RUNNING //
|
||||
////////////////////////
|
||||
|
||||
|
||||
self.CLOCK = -1;
|
||||
subscribe("sim/start", function(){
|
||||
|
||||
Simulations.IS_RUNNING = true;
|
||||
$("#container").setAttribute("sim_is_running",true);
|
||||
|
||||
self.CLOCK = 0;
|
||||
// save for later resetting
|
||||
self.sims.forEach(function(sim){
|
||||
sim.save(); // save for later resetting
|
||||
sim.save();
|
||||
});
|
||||
//publish("sim/next");
|
||||
|
||||
});
|
||||
subscribe("sim/reset", function(){
|
||||
subscribe("sim/stop", function(){
|
||||
|
||||
Simulations.IS_RUNNING = false;
|
||||
$("#container").removeAttribute("sim_is_running");
|
||||
|
||||
|
||||
// reload the network pre-sim
|
||||
self.sims.forEach(function(sim){
|
||||
sim.reload(); // reload the network pre-sim
|
||||
sim.reload();
|
||||
});
|
||||
|
||||
});
|
||||
subscribe("sim/next", function(){
|
||||
self.sims.forEach(function(sim){
|
||||
sim.nextStep();
|
||||
});
|
||||
});
|
||||
|
||||
///////////////////////
|
||||
// HELPERS AND STUFF //
|
||||
|
@ -377,15 +391,9 @@ function Sim(config){
|
|||
self.contagion = contagionLevel;
|
||||
};
|
||||
|
||||
self._dontStepAgain = false;
|
||||
self.nextStep = function(){
|
||||
|
||||
if(self._dontStepAgain) return;
|
||||
self._dontStepAgain = true;
|
||||
setTimeout(function(){
|
||||
self.STEP++;
|
||||
self._dontStepAgain = false;
|
||||
},420); // just in case...
|
||||
self.STEP++;
|
||||
|
||||
// "Infect" the peeps who need to get infected
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ function Boxes(){
|
|||
self.clear = function(){
|
||||
self.boxes.forEach(function(box){
|
||||
self.dom.removeChild(box);
|
||||
if(box.kill) box.kill();
|
||||
});
|
||||
self.boxes = [];
|
||||
};
|
||||
|
@ -158,6 +159,7 @@ function Boxes(){
|
|||
fadeOut(self.dom, removeBox);
|
||||
}
|
||||
removeFromArray(self.boxes, removeBox);
|
||||
if(removeBox.kill) removeBox.kill();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ subscribe("prepreload", function(){
|
|||
pre_preloader.parentNode.removeChild(pre_preloader);
|
||||
|
||||
//slideshow.gotoChapter("Preloader");
|
||||
slideshow.gotoChapter("Networks-Threshold");
|
||||
slideshow.gotoChapter("Complex");
|
||||
|
||||
publish("preload");
|
||||
}
|
||||
|
|
|
@ -4,28 +4,23 @@ function SimUI(container, color){
|
|||
self.container = container;
|
||||
self.container.classList.add("sim_ui");
|
||||
|
||||
// RESET
|
||||
var resetButton = document.createElement("div");
|
||||
resetButton.id = "reset_button";
|
||||
resetButton.innerHTML = getWords("sim_reset");
|
||||
self.container.appendChild(resetButton);
|
||||
resetButton.onclick = function(){
|
||||
if(Simulations.IS_RUNNING){
|
||||
publish("sim/reset");
|
||||
_updateButtonUI();
|
||||
}
|
||||
};
|
||||
|
||||
// START / NEXT
|
||||
var startButton = document.createElement("div");
|
||||
startButton.id = "start_button";
|
||||
self.container.appendChild(startButton);
|
||||
startButton.onclick = function(){
|
||||
startButton.onmousedown = function(event){
|
||||
event.stopPropagation();
|
||||
};
|
||||
startButton.ontouchstart = function(event){
|
||||
event.stopPropagation();
|
||||
};
|
||||
startButton.onclick = function(event){
|
||||
if(!Simulations.IS_RUNNING){
|
||||
Simulations.IS_RUNNING = true;
|
||||
publish("sim/start");
|
||||
_updateButtonUI();
|
||||
}else{
|
||||
publish("sim/next");
|
||||
Simulations.IS_RUNNING = false;
|
||||
publish("sim/stop");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -35,10 +30,18 @@ function SimUI(container, color){
|
|||
startButton.innerHTML = getWords("sim_start");
|
||||
self.container.removeAttribute("active");
|
||||
}else{
|
||||
startButton.innerHTML = getWords("sim_next");
|
||||
startButton.innerHTML = getWords("sim_stop");
|
||||
self.container.setAttribute("active",true);
|
||||
}
|
||||
};
|
||||
_updateButtonUI();
|
||||
|
||||
var _handler1 = subscribe("sim/start",_updateButtonUI);
|
||||
var _handler2 = subscribe("sim/stop",_updateButtonUI);
|
||||
self.container.kill = function(){
|
||||
unsubscribe(_handler1);
|
||||
unsubscribe(_handler2);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ function Slideshow(){
|
|||
_delayNewSlide = 800;
|
||||
self.scratch.scratchOut(); // Scratch out
|
||||
$("#container").removeAttribute("sim_is_running"); // remove that UI
|
||||
Simulations.IS_RUNNING = false; // STAHP
|
||||
}
|
||||
|
||||
_setTimeout(function(){
|
||||
|
|
Loading…
Reference in New Issue