Skip to content

Instantly share code, notes, and snippets.

@dtex
Created February 21, 2014 18:47
Show Gist options
  • Save dtex/9140660 to your computer and use it in GitHub Desktop.
Save dtex/9140660 to your computer and use it in GitHub Desktop.
function walk(dir) {
if (!dir) {
dir = "fwd";
}
if (task) {
task.stop();
}
task = temporal.queue([
{
wait: 250,
task: function() {
lf.coxa.to(82, 250);
lf.femur.to(111, 250);
lf.tibia.to(103, 250);
lb.coxa.to(98, 250);
lb.femur.to(111, 250);
lb.tibia.to(103, 250);
rf.coxa.to(77, 250);
rf.femur.to(70, 250);
rf.tibia.to(77, 250);
rb.coxa.to(103, 250);
rb.femur.to(70, 250);
rb.tibia.to(77, 250);
console.log( "a" );
}
},
{
wait: 750,
task: function() {
if (dir === "fwd") {
lf.femur.to(0, 250);
lf.coxa.to(130, 250);
} else {
lb.femur.to(0, 250);
lb.coxa.to(130, 250);
}
console.log( "b" );
}
},
{
wait: 250,
task: function() {
lf.coxa.to(103, 250);
lf.femur.to(70, 250);
lf.tibia.to(77, 250);
lb.coxa.to(77, 250);
lb.femur.to(70, 250);
lb.tibia.to(77, 250);
rf.coxa.to(98, 250);
rf.femur.to(111, 250);
rf.tibia.to(103, 250);
rb.coxa.to(82, 250);
rb.femur.to(111, 250);
rb.tibia.to(103, 250);
console.log( "c" );
}
},
{
wait: 750,
task: function() {
if (dir === "fwd") {
rf.femur.to(0, 250);
rf.coxa.to(50, 250);
} else {
rb.femur.to(0, 250);
rb.coxa.to(50, 250);
}
console.log( "d" );
walk(dir);
}
}
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment