# Question about Javis.jl

**URL:** <https://discourse.julialang.org/t/question-about-javis-jl/50811>\
**Category:** General Usage\
**Tags:** question, package, animations\
**Created:** [November 26, 2020, 12:52pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811 "2020-11-26T12:52:10Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [November 26, 2020, 5:45pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/21 "2020-11-26T17:45:13Z")

</div>

There is a pull request to make the live viewer work in Jupyter:  
[https://github.com/Wikunia/Javis.jl/pull/288](https://github.com/Wikunia/Javis.jl/pull/288)

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.

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [November 26, 2020, 7:08pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/22 "2020-11-26T19:08:36Z")

</div>

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)](https://scratch.mit.edu/projects/330040758/). Do you have any tips on how I can improve it?

````julia
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")

```
````

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [November 26, 2020, 9:26pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/23 "2020-11-26T21:26:00Z")

</div>

I switched 1:70 to 1:200 and the result was much better. I also modified myvideo = Video(700, 700)

![orbita](https://global.discourse-cdn.com/julialang/original/3X/5/1/51d1148bdf65faa325878a6141d835f819e56da4.gif)

---

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [November 27, 2020, 4:19am UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/24 "2020-11-27T04:19:13Z")

</div>

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](https://julialang.zulipchat.com/#narrow/stream/253420-javis) 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

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [November 27, 2020, 12:34pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/25 "2020-11-27T12:34:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [November 27, 2020, 3:42pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/26 "2020-11-27T15:42:11Z")

</div>

Looks good. I would probably slow it down even further and maybe use a black background to represent space. 😃

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [November 27, 2020, 3:53pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/27 "2020-11-27T15:53:19Z")

</div>

```julia
using Javis

function ground(args...)
    background("black") # 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(700, 700)

path_of_red = Point[]
path_of_blue = Point[]

Background(1:500, ground)
yellow_ball = Object(1:500, (args...)->object(O, "yellow"), Point(0,0))
red_ball = Object(1:500, (args...)->object(O, "red"), Point(200,0))
act!(red_ball, Action(anim_rotate_around(2π, O)))
blue_ball = Object(1:500, (args...)->object(O, "blue"), Point(150,30))
act!(blue_ball, Action(anim_rotate_around(24π, red_ball)))
Object(1:500, (args...)->path!(path_of_red, pos(red_ball), "red"))
Object(1:500, (args...)->path!(path_of_blue, pos(blue_ball), "blue"))

render(myvideo; pathname="tutorial_1.gif")

```

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [November 27, 2020, 3:53pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/28 "2020-11-27T15:53:32Z")

</div>

![orbita2](https://global.discourse-cdn.com/julialang/original/3X/d/c/dc67fd25d82363deb607b51906fda03c88994526.gif)

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [November 27, 2020, 4:35pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/29 "2020-11-27T16:35:07Z")

</div>

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

![orbita3](https://global.discourse-cdn.com/julialang/original/3X/d/3/d30402f2ba258b0e4eceee3f82b7fa8905510ea2.gif)

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 30, 2020, 9:06am UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/31 "2020-11-30T09:06:03Z")

</div>

Earth is flat? And so is moon and sun? I knew it is true! 👍 😉

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [December 1, 2020, 11:02am UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/32 "2020-12-01T11:02:29Z")

</div>

And they have all the same size 🙂

---

<div class="post-metadata">

**Author:** ![adeil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeil/32/16564_2.png) [@adeil](https://discourse.julialang.org/u/adeil)\
**Post date:** [December 2, 2020, 12:21pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811/33 "2020-12-02T12:21:08Z")

</div>

@oheil and @Wikunia, learning from you. Thanks!

![orbita_teste](https://global.discourse-cdn.com/julialang/original/3X/3/a/3a2ddc057d1c964c71ab93401d478900b960de1f.gif)

[Previous page](https://discourse.julialang.org/t/question-about-javis-jl/50811.md?page=1)
