Interactive/Animated graphics a-la scratch.mit.edu?

Suppose someone wanted to teach computer programming concepts using Julia through interactive graphical animations a-la scratch? Are there any packages that let you open a window and draw objects/move them around/animate them?

I’ve seen Luxor, but it seems like it’s designed around drawing static image files (like png or svg files) and/or maybe combining them into a static animation/movie.

I would recommend that they just use Scratch directly.

Julia is an extremely powerful language, but it contains a lot of ingredients that are not suitable for an audience that Scratch is perfect for.

Simple generic concepts (variables, loops, control flow, etc) from Scratch will just carry over to other languages, including Julia.

Yeah, the audience here has already learned some scratch, and wants to move up to something a little more useful to control stuff on an RPi but the motivating factor of watching graphics move around on the screen is still strong.

Personally I would go for

https://racket-lang.org/

which has books on programming for children.

A very nicely designed Lisp dialect. After which one can move to Julia, which is another very nicely designed Lisp dialect :wink:

3 Likes

Awesome I had never heard of Racket but will check that out quite thoroughly!

1 Like

In particular,

seems very nicely designed.

The responses here give a lot of examples of alternative teaching languages to Scratch, but I’m still interested in the original question. Are there Julia packages for live sprite-like object animation and interaction (e.g. collision detection) in a window?

1 Like

Yes. I’m still interested in that sort of thing as well. Right now I’m looking into doing a GtkReact based window for very simple Mandelbrot set drawing, zooming, interaction. I think you could probably do sprite based stuff this way too, but it’s all going to be fairly low level.

If you are looking for general interactivity with few constraints, Pluto.jl might be useful.

It displays arbitrary graphics, and if those graphics depend on parameters defined in other cells, the graphics will get updated immediately when their params change. You can also do animations by having variables that are bound to time.

On its own it is not geared towards kids though. But its reactivity probably does half of what you are looking for, and its generality should allow you to use it with whichever libraries you want. Using it to play with https://github.com/GiovineItalia/Compose.jl graphics might be accessible and fun.

2 Likes

Hey! I am very interested in this question! kolia mentioned my Pluto.jl project, which is primarily designed for the undergraduate level. It does make programming and interactivity easier, but it does not provide anything exciting (graphics, games) on its own.

Pluto with Luxor might be nice for education, its author cormullion made this cool GIF. But Pluto’s interaction is always one-directional: sliders and buttons defined in different cells - it’s not a platform to make games :frowning:

At the school where I worked we had a lot of success with scratch! With more advanced students we started with python, with PyGame (also works online through repl.it, and students can share games with eachother), or by controlling a raspberry Pi. (also have a look at the micro:bit if you want to do electronics)

Minecraft Education edition looks exciting - there’s an in-game scratch-style programing language to control the world with. And this has a natural advancement to Julia: there is a Julia package PiCraft.jl to control the minecraft world using Julia. Less intuitive than the control-flow-language, but you can do more powerful things like fractals!

1 Like

This one?

5 Likes

Hi @cormullion
I was wondering do one needs Jupyter Notebooks or Juno / VS Code to create the interactive drawing/animation like above?

Is using Julia REPL only able to have the interactive widget like the one you created?

You need an environment that provides some widgets, like sliders and checkboxes. Jupyter notebooks can use Interact.jl for these (if I remember right) but these days I’d use Pluto.jl for this kind of thing.

(Does VS-Code have widgets and/or Jupyter notebook integration? I haven’t looked yet.)

I will check with Jupyter notebooks, SO Pluto.jl is better than Jupyter Notebooks ?

We can simulate differential equations, surface plot with widget as well for changeable variable.