-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Morphs and Partially draw Objects #482
Conversation
…e, also introduces new pathtopoly
Codecov Report
@@ Coverage Diff @@
## main #482 +/- ##
===========================================
- Coverage 96.50% 77.74% -18.76%
===========================================
Files 35 38 +3
Lines 1630 1991 +361
===========================================
- Hits 1573 1548 -25
- Misses 57 443 +386
Help us with your feedback. Take ten seconds to tell us how you rate us. |
…ons from no export (they should be exported)
…unc with luxor draw disabled
…fferent number of jpaths
Thanks for the fast response. Perfect looking forward to thread safety as well then |
src/structs/Object.jl
Outdated
empty!(CURRENT_JPATHS) | ||
global CURRENT_FETCHPATH_STATE = true | ||
global DISABLE_LUXOR_DRAW = true | ||
v, o, f = nothing, nothing, 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.
Hi @ArbitRandomUser, can't you pass v, o, f
explicitly as arguments to getjpaths
instead of defining them as nothing, nothing, nothing
? It looks they are always available where getjpaths!
is called
I think we can now set Luxor to 3.5 and run the tests 😄 |
tests failed , it seems theres some clash in the deps. will this be fixed by bumping the julia version up ? |
Yeah Luxor.jl needs Julia 1.6 now which is fine as it's the LTS |
@Wikunia that didnt work . |
You need to change it here as well: https://github.com/JuliaAnimators/Javis.jl/blob/main/.github/workflows/ci.yml#L12 |
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.
Just some minor things but afterwards I would like to merge.
Thanks a lot for your awesome work. Looking forward to use this functionality.
CHANGELOG.md
Outdated
@@ -2,7 +2,14 @@ | |||
|
|||
# PR changes | |||
- changed render method for mp4 to use ffmpeg directly inplace of VideoIO | |||
|
|||
- Added jpaths a field in Object that is usefull for morphs and partial drawing |
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.
*useful
src/luxor_overrides.jl
Outdated
""" | ||
_betweenpoly_noresample(loop1,loop2,k; easingfunction = easingflat) | ||
|
||
Just like _betweenpoly from Luxor , but expects polygons `loop1` and `oop2` to be of same size , and |
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.
*loop2
src/partial_draw.jl
Outdated
|
||
returns the sum of all the lengths of the polys that this `jpath` contains | ||
""" | ||
len_jpath(jpath::JPath) = sum([ |
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.
no need to create an array here
src/structs/JPath.jl
Outdated
JPath(polys, closed, fill, stroke, lastaction, linewidth) = | ||
JPath(polys, closed, fill, stroke, lastaction, linewidth, nothing) | ||
|
||
CURRENT_JPATHS = JPath[] #TODO change to const later |
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.
can this be changed to const
?
src/structs/Object.jl
Outdated
@@ -1,3 +1,4 @@ | |||
include("JPath.jl") |
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.
let's keep all includes in one place, similar to the structs
test/morphing_old.jl
Outdated
@@ -0,0 +1,217 @@ | |||
astar(args...; do_action = :stroke) = star(Point(-100, -100), 30, 5, 0.5, 0, do_action) |
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.
can this file be removed seems like it's not used, right?
Hey! Just did a first pass review of the PR - WOW. |
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)?How did you address these issues with this PR? What methods did you use?
PR allows Arbitrary morphs from any
Object
toObject
,Object
toFunction
.and also keyframed morphs with
Animations.jl
.PR also brings in ability to draw Objects partially , and "show-creation" (and destruction) of objects.
This is made possible with the help of JPath a structure holding data of polygons and how to fill and stroke them.
Every Javis
Object
now has a ajpaths
field an array forJPath
that is got from evaluating theobject.func
fo theObject
Extracting the polygons is made possible by over-riding luxors strokepath/stroke/fillpath/fillpreserve methods . These four methods are only ways to lay the current path onto the canvas and all of luxors "drawing function" eventually call one or more of these four. (except for text ).
Morphs between polygons are using a modified version of luxors polymorph. (modified so that
polys dont have to be resampled everytime its called)
Limitations:
afaik...
sethue
in Actions. Morphs will work , but the sethue will notif you want to change hue while morphing you will have to change the hue of the target you are morphing to.
but might not be the most "natural" or simplest morph possible.morphs are somewhat "natural" now by offseting the index for best match between two polygons. But individual polygons are not matched for the shortest transformationExamples for Morphs:
Object
toObject
morphs ...Object
toFunction
morphs ...Keyframed morphs using Animations.jl
Examples for Partial Draw .