Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GeePawHill/b987b9d91060b8341990a7ea81358656 to your computer and use it in GitHub Desktop.
Save GeePawHill/b987b9d91060b8341990a7ea81358656 to your computer and use it in GitHub Desktop.
Pattern is context().action().object().
assume() starts the context for setting defaults, so assume().format(...) sets a default format
mark(ms) starts the script step context, saying, at time ms, do the action
then() just continues the previous mark
head() is a custom action, not a built-in, it clears the existing column and puts a headline up.
sketch() is a built-in, it will cause the following actor to be sketched.
letters() is a custom object(), creating a text and modifying it.
group(), name(), at() and format() are all built-ins, all objects support them.
private Step stack2()
{
assume().format("largeCodeFormat");
mark(0).head("A Program's Stack");
then().drawStack();
mark(22).head("The Household Progam");
mark(26).sketch().letters("main()").group("stack").at(stackTextPosition(0));
mark(30).sketch().letters("doChores()").group("catchAndThrow").at(stackTextPosition(1));
mark(33).sketch().letters("takeOutTrash()").group("stack").at(stackTextPosition(2));
mark(37).sketch().letters("putBagsInCans()").group("stack").at(stackTextPosition(3));
mark(40).sketch().letters("putOneBagInCan()").group("stack").at(stackTextPosition(4));
mark(44).sketch().letters("openCan()").group("catchAndThrow").at(stackTextPosition(5));
then().sketch().letters("whoops, he forgot openCan()").named("joke").at(jokePosition());
mark(49).fadeOut().the("joke");
}
// here's the original
private Step stack()
{
buildPhrase();
head("A Program's Stack");
drawStack();
mark(22);
head("The Household Program");
mark(26);
Letters main = new Letters("main()", stackTextPosition(0), largeCodeFormat);
disappearingStackText.add(main);
sketch(500d, main);
mark(30);
doChores = new Letters("doChores()", stackTextPosition(1), largeCodeFormat);
catchAndThrowColorText.add(doChores);
sketch(500d, doChores);
mark(33);
Letters takeOutTrash = new Letters("takeOutTrash()", stackTextPosition(2), largeCodeFormat);
disappearingStackText.add(takeOutTrash);
sketch(500d, takeOutTrash);
mark(34);
mark(37);
Letters putBagsInCan = new Letters("putBagsInCans()", stackTextPosition(3), largeCodeFormat);
disappearingStackText.add(putBagsInCan);
sketch(500d, putBagsInCan);
mark(40);
Letters putOneBagInCan = new Letters("putOneBagInCan()", stackTextPosition(4), largeCodeFormat);
disappearingStackText.add(putOneBagInCan);
sketch(500d, putOneBagInCan);
mark(44);
openCan = new Letters("openCan()", stackTextPosition(5), largeCodeFormat);
sketch(500d, openCan);
catchAndThrowColorText.add(openCan);
Letters joke = joke("whoops, he forgot openCan()");
mark(49);
disappear(joke);
return endBuild();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment