Skip to content

Instantly share code, notes, and snippets.

@phivk
Last active August 28, 2018 21:15
Show Gist options
  • Save phivk/c25ab4e3695b8fbfde38a3db3c14ed27 to your computer and use it in GitHub Desktop.
Save phivk/c25ab4e3695b8fbfde38a3db3c14ed27 to your computer and use it in GitHub Desktop.
Map Projection
Map Projection
Welcome Animation
button press -> Map Animation 1
Map Animation 1
button press -> Map Animation 2
1 Playing
timer -> 1 Ended
1 Ended
Map Animation 2
button press -> Map Animation 3
2 Playing
timer -> 2 Ended
2 Ended
Map Animation 3
button press -> Map Animation 4
3 Playing
timer -> 3 Ended
3 Ended
Map Animation 4
button press -> Map Animation 5
4 Playing
timer -> 4 Ended
4 Ended
Map Animation 5
button press -> Map Animation 1
5 Playing
timer -> 5 Ended
5 Ended
function render_state(state){
if (state.image_url) {
return $("img",
{
src: state.image_url,
style: {
width: "100px",
margin: "1rem"
}
}
);
}
else {
return $(
"div",
{
style: {
display: 'inline-block',
width: "10rem",
margin: '1rem',
}
},
state.name
);
}
}
function render_button(model, eventToEmit, buttonText) {
console.log(model);
return $(
'button',
{
style: {
display: 'inline-block',
width: "100px",
margin: '1rem',
},
onClick: function(){ model.emit(eventToEmit) }
},
buttonText
)
}
function render(model){
console.log(model);
return $(
"div",
render_state(model.active_states[0]),
render_state(model.active_states[0].parent),
$("br"),
render_button(
model,
'auto_next',
model.active_states[0].parent.name === "Remote Control Up" ? "auto_next" : ""
),
render_button(
model,
model.active_states[0].parent.name === "Remote Control Up" ? "user_put down remote control" : "user_pick up remote control",
model.active_states[0].parent.name === "Remote Control Up" ? "user_put down remote control" : "user_pick up remote control"
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment