-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
[WIP] Grid Lines Animation #18
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18 +/- ##
==========================================
+ Coverage 87.06% 90.88% +3.81%
==========================================
Files 2 4 +2
Lines 201 329 +128
==========================================
+ Hits 175 299 +124
- Misses 26 30 +4
Continue to review full report at Codecov.
|
Can you clarify what you mean by your second point of creating a mutable Line object? We should always make sure that we have different names then Luxor to not have ambiguity issues. |
BTW your javis try failed because you tried to define two functions. The javis function only accepts a single function and then a couple of transformation structs if needed. The single function can take in the arguments movie, action and frame such that you in general have all the information needed to do whatever you like to do in this animation action if that makes sense. Out of the top of my head without testing I would say that this will work:
or something like that. This is of course the user unfriendly version which needs to be abstracted into an easy to use version for the grid animation. |
I am going to continue hacking on this but we are making progress! We have a proof of concept gif! @Wikunia , I tried your proposed fix about attempting to change this code snippet in filecounter = 1
for frame in frames
Drawing(video.width, video.height, "$(tempdirectory)/$(lpad(filecounter, 10, "0")).png")
origin()
start_translation = Point(gettranslation()...)
# this frame needs doing, see if each of the scenes defines it
for action in actions
if frame in action.frames
@layer begin
compute_transformation!(action, video, frame)
perform_transformation(action)
res = action.func(video, action, frame)
if res isa Point
trans = cairotojuliamatrix(getmatrix())*res
trans.p -= start_translation
video.defs[action.id] = trans
end
end
end
end
finish()
filecounter += 1
end However, though I was able to create the line gif above, I could not get all the tests to pass. Here is the error message from the testing:
Although it is obviously not great, I wrapped the line where the error occurs with a try-catch block. Now, all the tests work. I figure while I work on extending the functionality of this animation, this will do while you can see where the error is coming from @Wikunia : filecounter = 1
for frame in frames
Drawing(video.width, video.height, "$(tempdirectory)/$(lpad(filecounter, 10, "0")).png")
origin()
start_translation = Point(gettranslation()...)
# this frame needs doing, see if each of the scenes defines it
for action in actions
if frame in action.frames
@layer begin
compute_transformation!(action, video, frame)
perform_transformation(action)
res = action.func(video, action, frame)
if action.id !== nothing && res !== nothing
trans = cairotojuliamatrix(getmatrix())*res
try
trans.p -= start_translation
catch
continue
end
video.defs[action.id] = trans
end
end
end
end
finish()
filecounter += 1
end |
We got it @Wikunia ! 🎉 🎉 🎉 I think this is ready for review now. I'll let you see how to fix the problem in |
Great! Thanks for pinging me |
Hey @Wikunia , That fix you proposed worked. All tests are now passing without any hacks going on! 🎉 As for adding additional functionality, I added the ability to draw zero lines. Furthermore, I have now added the ability to choose directions where grid lines and zero lines finish: Bottom Right:Bottom Left:Top Right:Top Left:Current ProblemThis is somewhat embarrassing but I cannot seem to add kwargs to the function definition of my using Javis
using Luxor
function grid_animation()
video = Video(500, 500)
javis(
video,
[
Action(1:100, ground),
# Action(1:100, :line, draw_grid(truth_value=true)),
Action(1:100, :line, draw_grid),
Action(1:100, :line, zero_lines),
],
tempdirectory = "/home/src/Projects/javis/test/grid_test",
creategif = true,
pathname = "/home/src/Projects/javis/test/grid_test.gif",
)
end
# function draw_grid(video::Video=nothing, action::Action=nothing, frame::Int=1, truth_value::Bool=false)
function draw_grid(video::Video, action::Action, frame::Int) I want to have the two commented lines work by passing in a boolean from the |
Hey @Wikunia , I believe this is fully ready to merge. I addressed all your prior points, added in some tests and reference images, made sure all the checks passed, improved the documentation and syntax, and applied the optimizations you suggested. Think it is good to go? When you give me the OK, I'll merge it! 😄 |
I've added some more comments. For test cases you might want to test both functions in the same movie. |
You have a lot of code reuse such that it might be helpful to think of horizontal lines and of vertical lines separately. |
Almost done. Just finishing up with the closures! |
Additionally make sure that you resolve your merge conflicts. |
Thanks for the PR. Sorry for the long process but I'm sure it's getting faster the next times. Please feel free to merge this yourself. |
Hey @Wikunia ,
Working on creating the gridlines animation. So far, I have the idea of what I want in my head being:
line
object provided byLuxor.jl
FFMPEG
Right now, I generated a gif with at least the basic idea of drawing a line:
Not very thrilling yet and it is not using
javis
just yet as I am unsure of how to intelligently use it. More to come.