I’m not sure whether there is an even easier way to simply play the gif in Jupyter. Maybe one can a markdown cell which simply shows the gif? I haven’t used Jupyter for a long time.
As a test I modified the program to appear the orbits of the Earth, moon and sun as in scratch simulation in the link: on Scratch (mit.edu). Do you have any tips on how I can improve it?
using Javis
function ground(args...)
background("white") # canvas background
sethue("black") # pen color
end
function object(p=O, color="black")
sethue(color)
circle(p, 25, :fill)
return p
end
function path!(points, pos, color)
sethue(color)
push!(points, pos) # add pos to points
circle.(points, 2, :fill) # draws a circle for each point using broadcasting
end
myvideo = Video(500, 500)
path_of_red = Point[]
path_of_blue = Point[]
Background(1:70, ground)
yellow_ball = Object(1:70, (args...)->object(O, "yellow"), Point(0,0))
red_ball = Object(1:70, (args...)->object(O, "red"), Point(200,0))
act!(red_ball, Action(anim_rotate_around(2π, O)))
blue_ball = Object(1:70, (args...)->object(O, "blue"), Point(150,30))
act!(blue_ball, Action(anim_rotate_around(24π, red_ball)))
Object(1:70, (args...)->path!(path_of_red, pos(red_ball), "red"))
Object(1:70, (args...)->path!(path_of_blue, pos(blue_ball), "blue"))
render(myvideo; pathname="tutorial_1.gif")
```
Hey @adeil - this is wonderful and congrats on the animation! Alongside @Wikunia, I am the other co-creator of Javis. It’s amazing that you are using this for your students and it’d be great to hear more about what you are working on.
We have an active user community located on the Julia Zulip that you can join here once you make a Zulip account: Zulip There, you could ask additional questions about Javis if you have them or ask additional questions. Take care and all the best - we hope that Javis provides a useful tool for you and your students! ~tcp
Hi, @TheCedarPrince! Be happy that you liked the changes. Before the pandemic COVID-19, I already taught Python classes to my students, but since July I have been planning my classes for 2021 with Julia in mind. I was looking for a package to replace VPython and I liked Javis.jl. Thanks for the recommendation from the community. I already logged in.
It was just a test, but I ended up liking the result. I changed the colors of the astros to finish the animation. Thank you to all of you who have contributed. @cormullion@Wikunia@TheCedarPrince