Skip to content

Instantly share code, notes, and snippets.

@Ved-Mahajan
Created August 14, 2021 17:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ved-Mahajan/3c851bdb2a15735baf6498214a30c6ad to your computer and use it in GitHub Desktop.
Save Ved-Mahajan/3c851bdb2a15735baf6498214a30c6ad to your computer and use it in GitHub Desktop.
Javis Bio
using Animations
using Javis
using Luxor
function ground(args...)
sethue("black")
background("white")
end
function boxes(p::Point,w,h,action,color)
sethue(color)
box(p,w,h,action)
end
function box_by_points(p1::Point,p2::Point,action,color)
sethue(color)
box(p1,p2,action)
end
function make_animation()
nframes = 100
vid = Video(500,500)
Background(1:nframes,ground)
Object(1:nframes, (args...) -> boxes(O,500,500,:stroke,"black"))
m1 = Object(1:nframes, (args...) -> boxes(Point(-225,20),75,10,:fill,"black"))
m2 = Object(1:nframes, (args...) -> boxes(Point(0,20),200,10,:fill,"black"))
m3 = Object(1:nframes, (args...) -> boxes(Point(200,20),100,10,:fill,"black"))
m4 = Object(1:nframes, (args...) -> boxes(Point(-225,-20),75,10,:fill,"black"))
m5 = Object(1:nframes, (args...) -> boxes(Point(0,-20),200,10,:fill,"black"))
m6 = Object(1:nframes, (args...) -> boxes(Point(200,-20),100,10,:fill,"black"))
Object(1:nframes, (args...) -> boxes(Point(0,25 + 225/2),500,225,:fill,"#a0e8e2"))
Object(1:nframes, (args...) -> boxes(Point(100 + 5,0),15,50,:fill,"blue"))
Object(1:nframes, (args...) -> boxes(Point(145,0),15,50,:fill,"blue"))
Object(1:nframes, (args...) -> boxes(Point(-110,0),20,50,:fill,"red"))
Object(1:nframes, (args...) -> boxes(Point(-185,0),20,50,:fill,"red"))
lid1 = Object(1:nframes, (args...) -> box_by_points(Point(-195,-25),Point(-100 - 95/2, -25-5),:fill,"red"))
lid2 = Object(1:nframes, (args...) -> box_by_points(Point(-100,-25),Point(-100 - 95/2, -25-5),:fill,"red"))
act!(lid1, Action(1:10, anim_rotate_around(-pi/2,Point(-195,-25))))
act!(lid2, Action(1:10, anim_rotate_around(pi/2,Point(-100,-25))))
render(vid; pathname = "chanel.gif")
end
make_animation()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment