Skip to content
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

[BUG] @JLayer changes Action behaviour. #417

Closed
gpucce opened this issue Sep 12, 2021 · 6 comments · Fixed by #418
Closed

[BUG] @JLayer changes Action behaviour. #417

gpucce opened this issue Sep 12, 2021 · 6 comments · Fixed by #418
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@gpucce
Copy link
Member

gpucce commented Sep 12, 2021

Describe the bug

@jlayers changes an Action behaviour it shouldn't.

To Reproduce

  1. Julia Version (i.e. output of julia -v): 1.6.2

  2. Operating system (Mac, Linux, Windows): Windows 10

  3. Javis version (i.e output of ] status Javis in the REPL) 0.6.2

  4. Minimum working code example that led to bug:

using Javis

nolayer_video = Video(500, 500)

function ground(args...)
    background("black") # canvas background
    sethue("white") # pen color
end

Background(1:140, ground)

circ = Object(JCircle(O, 20, action=:fill, color="white"))

act!(circ, Action(1:70, anim_translate(Point(150, 150))))
act!(circ, Action(70:140, anim_translate(Point(-150, -150))))

render(nolayer_video, pathname="mwe1.gif")


layer_video = Video(500, 500)

Background(1:140, ground)

l1 = @JLayer 1:140 begin
    Object(JCircle(O, 20, action=:fill, color="white"))
end

act!(l1, Action(1:70, anim_translate(Point(150, 150))))
act!(l1, Action(70:140, anim_translate(Point(-150, -150))))

render(layer_video, pathname="mwe2.gif")

mwe1.gif:
mwe1

mwe2.gif:
mwe2

@gpucce gpucce added the bug Something isn't working label Sep 12, 2021
@gpucce
Copy link
Member Author

gpucce commented Sep 12, 2021

I think this happens because the second action uses the starting position of the Layer instead of the current one. If you can confirm this makes sense or point me a bit where to look. I can try to work on the issue myself!!

@TheCedarPrince
Copy link
Member

Hey @gpucce - something is definitely going wrong here. Thanks for providing the Minimal working examples. As you see in example 1, it works fine for standard objects. Something is going wrong with layers as keep should be "keeping" the last position of where the layer was moved to. @Wikunia and @Sov-trotter , I tried explicitly setting keep = true to see if the behavior continued and it does. I am thinking it has something to do with what the layer returns. However, I do not know where to look just yet as it does not throw an error. Any thoughts?

@TheCedarPrince TheCedarPrince added the help wanted Extra attention is needed label Sep 13, 2021
@Sov-trotter
Copy link
Member

Sov-trotter commented Sep 13, 2021

This is not an issue with layers but actions in general i guess as explored here, #369

Although this might be also due to https://github.com/Wikunia/Javis.jl/blob/master/src/Javis.jl#L441

@gpucce
Copy link
Member Author

gpucce commented Sep 13, 2021

Hi thanks for replying! Reading the linked issue it feels like with the action I wrote it would work fine as it does without the layer. So I believe I am missing something can you explain a little better to help me understand? Thanks!

@Wikunia
Copy link
Member

Wikunia commented Sep 13, 2021

@Sov-trotter as the anim translate should be fixed now regarding issue #369 and as it works for objects as expected now (hopefully as it's written in the docs 😊 ) I would say this is an error regarding layers only. I can have a look at this in a few minutes

@gpucce
Copy link
Member Author

gpucce commented Sep 14, 2021

I'm trying to work on this with advice from @Wikunia.

@gpucce gpucce mentioned this issue Sep 14, 2021
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants