[Grace-core] Animations in Grace

Kim Bruce kim at cs.pomona.edu
Sun Sep 1 15:52:38 PDT 2013


The simple examples work fine.  For example, you'll see the frogger example in the repository.  That is easier than the basketball because the cars simply move in a straight line until they fall off the screen.  And again, the block in the "while()do().." second parameter is really a block that just does a single step.

Again the real key is how do you stage these so that one block of code (running on a timer) isn't initiated until another block of code (also on a timer) is completed.  My while()do()finally() let's me take care of one thing after everything else has finished, but that seems to be harder with nested loops.

The examples you suggest can all be done pretty straightforwardly (though I haven't implemented them all yet), it's just going beyond that which is the issue :-(

Kim



On Aug 31, 2013, at 3:14 PM, Lex Spoon <lex at lexspoon.org> wrote:

> I think James is onto something about the stepping model versus
> threading. Better be careful what examples you pick!
> 
> As an argument in favor of stepping, it is a more robust way to write
> professional software later on. Practically all GUI code is written in
> terms of a single thread and a panoply of callback mechanisms, and
> IMHO there is good reason for that. Your pain in developing new
> examples will not be in vain!
> 
> I taught a few young people to program things in Squeak's EToys, which
> uses the stepping model. Here are a few notes from that.
> 
> A really important primitive that Alan Kay insisted is easy to access
> is "repeat on every tick". Does Grace have such a thing? In EToys,
> it's the default: if you drop an instruction on the playing field, it
> starts running. By having "repeat on every tick" easily available, you
> get to put off teaching students about loops, which many people report
> is a stumbling block for new programmers.
> 
> In thinking about examples, here are a few that work well in EToys:
> 
> - Simulation of moving objects, like basketballs in the example Kim
> mentions. You can move something in a straight line by adding a delta
> to the position on every tick. You can make it fall under the effect
> of gravity by adding a delta to the delta every tick.
> 
> - Steering. If the graphics libraries has each widget have a
> "heading", then you can provide methods for moving forward and for
> turning left or right. Given that, it's really easy to connect one
> widget to another and let people drive a car -- I've taught dozens of
> little kids how to do that one. You can then make it more elaborate,
> for example having the car steer itself when it realizes it is going
> off the road.
> 
> - Simulations on a grid, as in StarLogo. For example, it is not
> complicated to simulate ants with 2-3 kinds of pheromones to get them
> finding food and bringing it back to the lair.
> 
> Another trick that Alan emphasizes is letting students be artistic
> with the objects they are using in the simulation. Don't make them
> build using squares and circles. Let them import and use clip art, and
> it will dramatically improve their engagement.
> 
> Just a few thoughts. I'm sure it is exciting to have a Grace class coming up!
> 
> Lex
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core




More information about the Grace-core mailing list