jumping navigation
This commit is contained in:
parent
be5f818d6b
commit
335810b29d
19 changed files with 353 additions and 64 deletions
173
css/balloon.css
Executable file
173
css/balloon.css
Executable file
|
@ -0,0 +1,173 @@
|
|||
button[data-balloon] {
|
||||
overflow: visible;
|
||||
}
|
||||
[data-balloon] {
|
||||
position: relative;
|
||||
}
|
||||
[data-balloon]:before,
|
||||
[data-balloon]:after {
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
filter: alpha(opacity=0);
|
||||
-khtml-opacity: 0;
|
||||
-moz-opacity: 0;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
-webkit-transition: all 0.1s ease-out 0.1s;
|
||||
transition: all 0.1s ease-out 0.1s;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
-webkit-transform: translate(-50%, 10px);
|
||||
-ms-transform: translate(-50%, 10px);
|
||||
transform: translate(-50%, 10px);
|
||||
-webkit-transform-origin: top;
|
||||
-ms-transform-origin: top;
|
||||
transform-origin: top;
|
||||
}
|
||||
[data-balloon]:after {
|
||||
background: rgba(17, 17, 17, 0.9);
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
content: attr(data-balloon);
|
||||
font-size: 18px;
|
||||
padding: .5em 1em;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 11px;
|
||||
}
|
||||
[data-balloon]:before {
|
||||
background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') no-repeat;
|
||||
background-size: 100% auto;
|
||||
height: 6px;
|
||||
width: 18px;
|
||||
content: "";
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
[data-balloon]:hover:before,
|
||||
[data-balloon][data-balloon-visible]:before,
|
||||
[data-balloon]:hover:after,
|
||||
[data-balloon][data-balloon-visible]:after {
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
||||
filter: alpha(opacity=100);
|
||||
-khtml-opacity: 1;
|
||||
-moz-opacity: 1;
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
-webkit-transform: translate(-50%, 0);
|
||||
-ms-transform: translate(-50%, 0);
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
[data-balloon].font-awesome:after {
|
||||
font-family: FontAwesome;
|
||||
}
|
||||
[data-balloon][data-balloon-break]:after {
|
||||
white-space: pre;
|
||||
}
|
||||
[data-balloon-pos="down"]:before,
|
||||
[data-balloon-pos="down"]:after {
|
||||
bottom: auto;
|
||||
left: 50%;
|
||||
top: 100%;
|
||||
-webkit-transform: translate(-50%, -10px);
|
||||
-ms-transform: translate(-50%, -10px);
|
||||
transform: translate(-50%, -10px);
|
||||
}
|
||||
[data-balloon-pos="down"]:after {
|
||||
margin-top: 11px;
|
||||
}
|
||||
[data-balloon-pos="down"]:before {
|
||||
background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') no-repeat;
|
||||
background-size: 100% auto;
|
||||
height: 6px;
|
||||
width: 18px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
[data-balloon-pos="down"]:hover:before,
|
||||
[data-balloon-pos="down"][data-balloon-visible]:before,
|
||||
[data-balloon-pos="down"]:hover:after,
|
||||
[data-balloon-pos="down"][data-balloon-visible]:after {
|
||||
-webkit-transform: translate(-50%, 0);
|
||||
-ms-transform: translate(-50%, 0);
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
[data-balloon-pos="left"]:before,
|
||||
[data-balloon-pos="left"]:after {
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
right: 100%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(10px, -50%);
|
||||
-ms-transform: translate(10px, -50%);
|
||||
transform: translate(10px, -50%);
|
||||
}
|
||||
[data-balloon-pos="left"]:after {
|
||||
margin-right: 11px;
|
||||
}
|
||||
[data-balloon-pos="left"]:before {
|
||||
background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') no-repeat;
|
||||
background-size: 100% auto;
|
||||
height: 18px;
|
||||
width: 6px;
|
||||
margin-right: 5px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
[data-balloon-pos="left"]:hover:before,
|
||||
[data-balloon-pos="left"][data-balloon-visible]:before,
|
||||
[data-balloon-pos="left"]:hover:after,
|
||||
[data-balloon-pos="left"][data-balloon-visible]:after {
|
||||
-webkit-transform: translate(0, -50%);
|
||||
-ms-transform: translate(0, -50%);
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
[data-balloon-pos="right"]:before,
|
||||
[data-balloon-pos="right"]:after {
|
||||
bottom: auto;
|
||||
left: 100%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(-10px, -50%);
|
||||
-ms-transform: translate(-10px, -50%);
|
||||
transform: translate(-10px, -50%);
|
||||
}
|
||||
[data-balloon-pos="right"]:after {
|
||||
margin-left: 11px;
|
||||
}
|
||||
[data-balloon-pos="right"]:before {
|
||||
background: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E') no-repeat;
|
||||
background-size: 100% auto;
|
||||
height: 18px;
|
||||
width: 6px;
|
||||
margin-bottom: 0;
|
||||
margin-left: 5px;
|
||||
}
|
||||
[data-balloon-pos="right"]:hover:before,
|
||||
[data-balloon-pos="right"][data-balloon-visible]:before,
|
||||
[data-balloon-pos="right"]:hover:after,
|
||||
[data-balloon-pos="right"][data-balloon-visible]:after {
|
||||
-webkit-transform: translate(0, -50%);
|
||||
-ms-transform: translate(0, -50%);
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
[data-balloon-length]:after {
|
||||
white-space: normal;
|
||||
}
|
||||
[data-balloon-length="small"]:after {
|
||||
width: 80px;
|
||||
}
|
||||
[data-balloon-length="medium"]:after {
|
||||
width: 150px;
|
||||
}
|
||||
[data-balloon-length="large"]:after {
|
||||
width: 260px;
|
||||
}
|
||||
[data-balloon-length="xlarge"]:after {
|
||||
width: 90vw;
|
||||
}
|
||||
@media screen and (min-width: 768px) {
|
||||
[data-balloon-length="xlarge"]:after {
|
||||
width: 380px;
|
||||
}
|
||||
}
|
||||
[data-balloon-length="fit"]:after {
|
||||
width: 100%;
|
||||
}
|
13
index.html
13
index.html
|
@ -44,10 +44,11 @@
|
|||
<script src="js/sims/SandboxUI.js"></script>
|
||||
|
||||
<!-- Slides -->
|
||||
<script src="js/slides/Slides_Intro.js"></script>
|
||||
<script src="js/slides/Slides_OneOff.js"></script>
|
||||
<!--script src="js/slides/Slides_Iterated.js"></script>
|
||||
<script src="js/slides/Slides_Sandbox.js"></script-->
|
||||
<script src="js/slides/0_Slides_Intro.js"></script>
|
||||
<script src="js/slides/1_Slides_OneOff.js"></script>
|
||||
<script src="js/slides/2_Slides_Iterated.js"></script>
|
||||
<script src="js/slides/3_Slides_Tournament.js"></script>
|
||||
<!--script src="js/slides/Slides_Sandbox.js"></script-->
|
||||
|
||||
<!-- Main Code -->
|
||||
<script>
|
||||
|
@ -66,10 +67,10 @@ window.onload = function(){
|
|||
});
|
||||
|
||||
// Slide Select
|
||||
/*slideSelect = new SlideSelect({
|
||||
slideSelect = new SlideSelect({
|
||||
dom: $("#select"),
|
||||
slides: SLIDES
|
||||
});*/
|
||||
});
|
||||
|
||||
// First slide!
|
||||
slideshow.nextSlide();
|
||||
|
|
|
@ -3,14 +3,18 @@
|
|||
var Scratcher = {};
|
||||
exports.Scratcher = Scratcher;
|
||||
|
||||
Scratcher.scratch = function(){
|
||||
Scratcher.scratch = function(gotoID){
|
||||
|
||||
var dom = $("#scratcher");
|
||||
dom.style.display = "block";
|
||||
|
||||
Scratcher.scratchAnim(true)
|
||||
.then(function(){
|
||||
publish("slideshow/next");
|
||||
if(gotoID){
|
||||
publish("slideshow/goto", [gotoID]);
|
||||
}else{
|
||||
publish("slideshow/next");
|
||||
}
|
||||
})
|
||||
.then(function(){
|
||||
return Scratcher.scratchAnim(false);
|
||||
|
|
|
@ -16,7 +16,12 @@ function SlideSelect(config){
|
|||
};
|
||||
|
||||
// Populate dots
|
||||
for(var i=0; i<self.slides.length; i++) self.addDot(self.slides[i]);
|
||||
for(var i=0; i<self.slides.length; i++){
|
||||
var slide = self.slides[i];
|
||||
if(slide.id){
|
||||
self.addDot(slide);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,7 +36,7 @@ function SlideSelectDot(slide){
|
|||
|
||||
// On Click
|
||||
self.dom.onclick = function(){
|
||||
publish("slideshow/goto", [slide.id]);
|
||||
publish("slideshow/scratch", [slide.id]);
|
||||
};
|
||||
|
||||
// Listen to when the slide changes
|
||||
|
|
|
@ -13,10 +13,18 @@ function Slideshow(config){
|
|||
|
||||
// Reset: INITIAL VARIABLES
|
||||
self.reset = function(){
|
||||
|
||||
// On End?
|
||||
if(self.currentSlide && self.currentSlide.onend){
|
||||
self.currentSlide.onend(self);
|
||||
}
|
||||
|
||||
// Reset
|
||||
self.dom.innerHTML = "";
|
||||
self.slideIndex = -1;
|
||||
self.currentSlide = null;
|
||||
self.objects = {};
|
||||
|
||||
};
|
||||
self.reset();
|
||||
|
||||
|
@ -43,7 +51,7 @@ function Slideshow(config){
|
|||
}
|
||||
|
||||
// Send out message!
|
||||
// publish("slideshow/slideChange", [self.currentSlide.id]);
|
||||
publish("slideshow/slideChange", [self.currentSlide.id]);
|
||||
|
||||
};
|
||||
|
||||
|
@ -106,23 +114,29 @@ function Slideshow(config){
|
|||
//////////////////////////////////////////////////
|
||||
|
||||
// FORCE go to a certain slide
|
||||
/*self.gotoSlide = function(id){
|
||||
self.gotoSlide = function(id){
|
||||
|
||||
// Go ALL the way to the past
|
||||
self.reset();
|
||||
|
||||
// And just move all the way forward, what a hack.
|
||||
// TODO: a more efficient one that looks at id's FIRST.
|
||||
self.nextSlide(true);
|
||||
while(self.currentSlide.id != id){
|
||||
self.nextSlide(true);
|
||||
}
|
||||
// Slide & SlideIndex
|
||||
self.currentSlide = self.slides.find(function(slide){
|
||||
return slide.id==id;
|
||||
});
|
||||
self.slideIndex = self.slides.indexOf(self.currentSlide);
|
||||
|
||||
// On JUMP & on Start
|
||||
if(self.currentSlide.onjump) self.currentSlide.onjump(self);
|
||||
if(self.currentSlide.onstart) self.currentSlide.onstart(self);
|
||||
|
||||
// Send out message!
|
||||
publish("slideshow/slideChange", [self.currentSlide.id]);
|
||||
|
||||
};
|
||||
|
||||
// Subscribe to the "force goto" message...
|
||||
subscribe("slideshow/goto", function(id){
|
||||
self.gotoSlide(id);
|
||||
});*/
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -110,8 +110,6 @@ function Iterated(config){
|
|||
self.playerB.chooseHat(id);
|
||||
};
|
||||
|
||||
self.chooseOpponent("tft");
|
||||
|
||||
self.playOneRound = function(yourMove){
|
||||
|
||||
// Make your moves!
|
||||
|
@ -136,8 +134,8 @@ function Iterated(config){
|
|||
// Payoff Matrix
|
||||
self.dehighlightPayoff();
|
||||
|
||||
// Buttons
|
||||
self.activateButtons();
|
||||
// End Round
|
||||
publish("iterated/round/end");
|
||||
|
||||
});
|
||||
|
||||
|
@ -147,23 +145,21 @@ function Iterated(config){
|
|||
};
|
||||
|
||||
subscribe("iterated/cooperate", function(){
|
||||
publish("iterated/round/start");
|
||||
self.playOneRound(PD.COOPERATE);
|
||||
self.deactivateButtons();
|
||||
});
|
||||
|
||||
subscribe("iterated/cheat", function(){
|
||||
publish("iterated/round/start");
|
||||
self.playOneRound(PD.CHEAT);
|
||||
self.deactivateButtons();
|
||||
});
|
||||
|
||||
self.activateButtons = function(){
|
||||
publish("buttonCooperate/activate");
|
||||
publish("buttonCheat/activate");
|
||||
};
|
||||
self.deactivateButtons = function(){
|
||||
publish("buttonCooperate/deactivate");
|
||||
publish("buttonCheat/deactivate");
|
||||
};
|
||||
subscribe("iterated/newOpponent", function(id){
|
||||
self.chooseOpponent(id);
|
||||
self.playerA.resetFace();
|
||||
self.playerB.resetFace();
|
||||
});
|
||||
self.chooseOpponent("tft");
|
||||
|
||||
///////////////////////////////////////////////
|
||||
///////////// ADD, REMOVE, KILL ///////////////
|
||||
|
@ -176,6 +172,7 @@ function Iterated(config){
|
|||
|
||||
// Remove...
|
||||
self.remove = function(INSTANT){
|
||||
app.destroy();
|
||||
return _remove(self);
|
||||
};
|
||||
|
||||
|
@ -229,6 +226,13 @@ function IteratedPeep(config){
|
|||
self.eyebrows.visible = false;
|
||||
self.animated.addChild(self.eyebrows);
|
||||
|
||||
// RESET FACE
|
||||
self.resetFace = function(){
|
||||
self.eyebrows.visible = false;
|
||||
self.face.gotoAndStop(1);
|
||||
self.restingFace = true;
|
||||
};
|
||||
|
||||
// Position & Flip?
|
||||
g.y = 236;
|
||||
//g.rotation = 1;
|
||||
|
|
|
@ -107,6 +107,7 @@ function Splash(config){
|
|||
|
||||
// Remove...
|
||||
self.remove = function(INSTANT){
|
||||
app.destroy();
|
||||
return _remove(self);
|
||||
};
|
||||
|
||||
|
|
|
@ -378,12 +378,12 @@ function Tournament(config){
|
|||
};
|
||||
|
||||
// Remove...
|
||||
self.remove = function(INSTANT){
|
||||
return _remove(self);
|
||||
};
|
||||
|
||||
// TODO: KILL ALL LISTENERS, TOO.
|
||||
// TODO: Don't screw up when paused or looking at new tab
|
||||
self.remove = function(INSTANT){
|
||||
app.destroy();
|
||||
return _remove(self);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -79,9 +79,14 @@ SLIDES.push({
|
|||
message:"slideshow/next"
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
onend: function(self){
|
||||
self.objects.iterated.dehighlightPayoff();
|
||||
self.remove("topWords");
|
||||
self.remove("btmWords");
|
||||
self.remove("btnNext");
|
||||
}
|
||||
|
||||
},{
|
||||
onstart:function(){
|
||||
}
|
||||
});
|
||||
});
|
||||
|
71
js/slides/2_Slides_Iterated.js
Normal file
71
js/slides/2_Slides_Iterated.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
SLIDES.push({
|
||||
|
||||
id: "iterated",
|
||||
|
||||
onjump: function(self){
|
||||
|
||||
// Iterated Simulation
|
||||
self.add({id:"iterated", type:"Iterated", x:130, y:133});
|
||||
|
||||
},
|
||||
|
||||
onstart: function(self){
|
||||
|
||||
// ROUNDS
|
||||
var ROUNDS = [
|
||||
{id:"tft", num:5},
|
||||
//{id:"all_d", num:4},
|
||||
//{id:"all_c", num:4},
|
||||
//{id:"grudge", num:5},
|
||||
//{id:"prober", num:7}
|
||||
];
|
||||
ROUND_INDEX = 0;
|
||||
ROUND_NUM = 0;
|
||||
|
||||
self.add({
|
||||
id:"buttonCheat", type:"Button", x:275, y:403,
|
||||
text_id:"label_cheat",
|
||||
message:"iterated/cheat"
|
||||
});
|
||||
|
||||
self.add({
|
||||
id:"buttonCooperate", type:"Button", x:495, y:400,
|
||||
text_id:"label_cooperate",
|
||||
message:"iterated/cooperate"
|
||||
});
|
||||
|
||||
_.listenerRoundStart = subscribe("iterated/round/start", function(){
|
||||
publish("buttonCheat/deactivate");
|
||||
publish("buttonCooperate/deactivate");
|
||||
});
|
||||
_.listenerRoundEnd = subscribe("iterated/round/end", function(){
|
||||
|
||||
publish("buttonCheat/activate");
|
||||
publish("buttonCooperate/activate");
|
||||
|
||||
// Next round
|
||||
ROUND_NUM++;
|
||||
if(ROUND_NUM >= ROUNDS[ROUND_INDEX].num){
|
||||
|
||||
// Next opponent
|
||||
ROUND_NUM = 0;
|
||||
ROUND_INDEX++;
|
||||
if(ROUND_INDEX >= ROUNDS.length){
|
||||
publish("slideshow/scratch"); // NEXT SLIDE, WHATEVER
|
||||
}else{
|
||||
publish("iterated/newOpponent",[ROUNDS[ROUND_INDEX].id]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
onend: function(self){
|
||||
self.clear();
|
||||
}
|
||||
|
||||
},{
|
||||
onstart: function(self){}
|
||||
});
|
0
js/slides/3_Slides_Tournament.js
Normal file
0
js/slides/3_Slides_Tournament.js
Normal file
0
js/slides/4_Slides_Evolution.js
Normal file
0
js/slides/4_Slides_Evolution.js
Normal file
0
js/slides/5_Slides_Noise.js
Normal file
0
js/slides/5_Slides_Noise.js
Normal file
0
js/slides/7_Slides_Conclusion.js
Normal file
0
js/slides/7_Slides_Conclusion.js
Normal file
0
js/slides/8_Slides_Credits.js
Normal file
0
js/slides/8_Slides_Credits.js
Normal file
|
@ -1,23 +0,0 @@
|
|||
SLIDES.push({
|
||||
|
||||
id: "iterated",
|
||||
add:[
|
||||
|
||||
// The Iterated simulation
|
||||
{id:"iterated", type:"Iterated", x:130, y:125},
|
||||
|
||||
// Buttons
|
||||
{
|
||||
id:"buttonCheat", type:"Button", x:275, y:403,
|
||||
text_id:"label_cheat",
|
||||
message:"iterated/cheat"
|
||||
},
|
||||
{
|
||||
id:"buttonCooperate", type:"Button", x:495, y:400,
|
||||
text_id:"label_cooperate",
|
||||
message:"iterated/cooperate"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
});
|
34
lang/en.html
34
lang/en.html
|
@ -232,3 +232,37 @@ rules
|
|||
<p id="label_reproduce_top_5">
|
||||
3) reproduce top 5
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - -->
|
||||
<!-- - - - NAVIGATING CHAPTERS - - - -->
|
||||
<!-- - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<p id="chapter_intro">
|
||||
0. Introduction
|
||||
</p>
|
||||
<p id="chapter_oneoff">
|
||||
1. One Game
|
||||
</p>
|
||||
<p id="chapter_iterated">
|
||||
2. Repeated Game
|
||||
</p>
|
||||
<p id="chapter_tournament">
|
||||
3. One Tournament
|
||||
</p>
|
||||
<p id="chapter_evolution">
|
||||
4. Repeated Tournament
|
||||
</p>
|
||||
<p id="chapter_noise">
|
||||
5. Making Mistaeks
|
||||
</p>
|
||||
<p id="chapter_sandbox">
|
||||
6. Sandbox
|
||||
</p>
|
||||
<p id="chapter_conclusion">
|
||||
7. Conclusion
|
||||
</p>
|
||||
<p id="chapter_credits">
|
||||
X. Credits
|
||||
</p>
|
||||
|
|
Loading…
Reference in a new issue