-
-
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
first attempt at DelayedPosition #434
base: main
Are you sure you want to change the base?
Conversation
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.
Looks good to me so far. Does that mean we don't need this Future
approach? Or more or less: This is the future approach but called differently? I'm thinking we might want something like this also for rotation which is much less used though
src/Javis.jl
Outdated
@@ -253,6 +259,8 @@ function render( | |||
postprocess_frames_flow = identity, | |||
postprocess_frame = default_postprocess, | |||
) | |||
|
|||
STARTED_RENDERING[1] = true |
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.
I think this needs to be set to false
at the end again
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.
I added it at the end, maybe it can be reset within the empy_CURRENT_constants()
after naming it CURRENTLY_RENDERING
.
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.
once this works in general
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.
-
changed STARTED_RENDERING to CURRENTLY_RENDERING
-
didn't move
CURRENTLY_RENDERING[1] = false
insideempty_CURRENT_variables
because the latter is not called ifpathname
is empty, I don't know if there is a reason for that. if not I can move it inside it and make it a bit cleaner.
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.
I think we should call it in all cases.
Codecov Report
@@ Coverage Diff @@
## master #434 +/- ##
==========================================
- Coverage 96.19% 95.72% -0.48%
==========================================
Files 36 36
Lines 1604 1613 +9
==========================================
+ Hits 1543 1544 +1
- Misses 61 69 +8
Continue to review full report at Codecov.
|
yeah this is the future approach while writing it I thought delayed was more understandable of course I switch it back if you think future is better |
I will look for a way to add it to |
I think delayed makes perfect sense. I wonder whether we can abstract it away from the user though such that the user can still use pos for everything |
Maybe one way could be differentiating based on when the structure is created. We add another struct called If However, we would need to change the name of |
Codecov Report
@@ Coverage Diff @@
## main #434 +/- ##
==========================================
- Coverage 96.47% 96.43% -0.04%
==========================================
Files 35 36 +1
Lines 1617 1655 +38
==========================================
+ Hits 1560 1596 +36
- Misses 57 59 +2
Continue to review full report at Codecov.
|
@Wikunia I don't know what happened with codecov but I think it is disallowed on juliaanimators or smth like that. I think I sent you and @TheCedarPrince a the authorization to enable it. |
Thanks! |
@Wikunia as I told you on zulip I went on and added support for all shorthands except for @jshape but there is a way to do it i will add it some where. However now we can do this
And the result is this |
Awesome! Thanks a lot. One small question: what exactly does the last action mean? It's always hard to reason about an anim translate when the starting position is not the position of the object itself, right? |
In this case it is the same position maybe? In general it will work as if you had replaced the two |
I was wondering as the end position should be at the right of the circle center. It just takes the difference of end and start point of the two given which makes it hard to reason about but I think we don't need to worry about that here. Would just suggest that you use something else for test cases and documentation where it is clearer what should happen 😊 |
Sure I will, though also in this case looks like it behaves the way it should, if you wonder why it does not reach the end of the white line exactly is because I added |
But o1 is the circle isn't it ? 🤣 |
Yeah! But it will aim for the position of the circle at moment the yellow brick starts moving, this si the behaviour in general |
Hi @Wikunia it would be nice to have your review!! I'll add the test to raise the codecov but there should be nothing really important missing there for you to review the PR! |
Coverage seems to be doing good as well! |
Currently on the move. Will check later today 🙂 |
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.
I made some small comments.
One question regarding the DelayedPosition
struct.
Would it make sense to have the ability to get the x and y component with the .x
/ .y
syntax directly?
I think it that case we might be able to change all function arguments in Luxor to support AbstractPoint
and we wouldn't need to call this get_position
function for each AbstractPoint
we send over to Luxor
?
I mean for now it's okay as it is and then we don't need to create another Luxor release but it might be reasonable for the future. Let me know what you think.
That would be amazing |
@Wikunia I should have addressed all the comments! |
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.
LGTM you might wanna read through the documentation @TheCedarPrince
Also make sure to mention the functionality in the changelog @gpucce.
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 #433
How did you address these issues with this PR? What methods did you use?
I added a new struct called
DelayedPosition
a new constantconst STARTED_RENDERING = [false]
and functionget_delayed_position
which is almost aDelayedPosition
constructor.Then I added a method to
get_position(dp::DelayedPosition)
that checks if the rendering has started, using theSTARTED_RENDERING
constant and then if it is called for the first time setsdp.position = get_position(dp.obj)
and returnsdp.position
, otherwise just returnsdp.position
.all together this should allow smth like this
to return smth like this where the second upward shift starts from the circle position at the frame when the action with
get_delayed_position
starts:Problems
I had to add DelayedPosition amone the field types of
Translation
and among the argument types ofanim_translate
and this might be needed else where I still don't know.