-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arrange-animate objects vertically/horizontally #490
base: main
Are you sure you want to change the base?
arrange-animate objects vertically/horizontally #490
Conversation
Codecov Report
@@ Coverage Diff @@
## main #490 +/- ##
==========================================
- Coverage 77.74% 77.28% -0.47%
==========================================
Files 38 40 +2
Lines 1991 2210 +219
==========================================
+ Hits 1548 1708 +160
- Misses 443 502 +59
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/arrange.jl
Outdated
|
||
|
||
""" | ||
arrange() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add the parameters here
@Sov-trotter @Wikunia @gpucce @TheCedarPrince using Javis
video = Video(1000,1000)
nframes=250
groundj = Background(1:nframes,(args...) -> begin
background("black")
sethue("white")
end)
objj1 = Object(1:nframes,(args...)-> begin
box(O,100,100,:stroke)
return O
end,
Point(100,150)
)
objj2 = Object(1:nframes,(args...)-> begin
circle(O,50,:stroke)
return O
end,
Point(-100,250)
)
objj3 = Object(1:nframes,(args...)-> begin
#rotate(2π/12)
box(O,100,50,:stroke)
#star(O,50,3,0.5,0.0,:stroke)
return O
end,
Point(-200,-150)
)
objlist = [objj1,objj2,objj3]
frameno = 2
Object(1:nframes,(args...)->circle(O,5,:fill))
#act!(frameno,arrange(frameno:frameno+25,objlist,O;gap=0,dir=:horizontal,align=:left,towards=:top))
for dir in (:horizontal,:vertical)
global frameno
for align in (:left,:right)
for towards in (:top,:bottom)
act!(frameno,arrange(frameno:frameno+25,objlist,O;gap=0,dir=dir,align=align,towards=towards))
frameno=frameno+30
end
end
end
render(video,pathname="testarrange3.gif")
run(`mpv testarrange3.gif`)
|
@@ -376,6 +378,8 @@ function render( | |||
|
|||
# clear all CURRENT_* constants to not accidentally use a previous video when creating a new one | |||
empty_CURRENT_constants() | |||
haskey(video.defs, :RuntimeFunctionDict) ? empty!(video.defs[:RuntimeFunctionDict]) : | |||
nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go in the same line above I guess. But if it's the output of JuliaFormatter
then fell free to resolve.
src/runtimefuncs.jl
Outdated
at render time RuntimeFunctionMap[frame] is checked and every Func | ||
in the array is called with `func(frame)` | ||
""" | ||
#videoRuntimeFunctionDict = Dict{Int,Array{Function}}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
P.R also adds ability to arrange around objects now using Javis
video = Video(1000,1000)
nframes=300
groundj = Background(1:nframes,(args...) -> begin
background("black")
sethue("white")
end)
objj1 = Object(1:nframes,(args...)-> begin
sethue("yellow")
box(O,100,100,:stroke)
text("Target")
return O
end,
O-100
)
objj2 = Object(1:nframes,(args...)-> begin
circle(O,35,:stroke)
return O
end,
Point(-100,250)
)
objj3 = Object(1:nframes,(args...)-> begin
#rotate(2π/12)
box(O,150,50,:stroke)
#star(O,50,3,0.5,0.0,:stroke)
return O
end,
Point(-200,-150)
)
objlist = [objj2,objj3]
frameno = 20
for dir in (:horizontal,:vertical)
global frameno
for halign in (:left,:right)
for valign in (:top,:bottom)
act!(frameno,arrange(frameno:frameno+25,objlist,objj1;gap=0,dir=dir,halign=halign,valign=valign))
frameno=frameno+30
end
end
end
render(video,pathname="testarrange_obj.gif")
run(`mpv testarrange_obj.gif`) |
PR Checklist
If you are contributing to
Javis.jl
, please make sure you are able to check off each item on this list:CHANGELOG.md
with whatever changes/features I added with this PR?Project.toml
+ set an upper bound of the dependency (if applicable)?test
directory (if applicable)?Link to relevant issue(s)
Closes #
How did you address these issues with this PR? What methods did you use?
P.R allows objects to be arranged around other objects or a point
example