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

Fill issue #8

Open
marziabil opened this issue Aug 10, 2022 · 3 comments
Open

Fill issue #8

marziabil opened this issue Aug 10, 2022 · 3 comments

Comments

@marziabil
Copy link

Hi! I have another question.

If you look at the open mouth method in this file (https://github.com/marziabil/emojis/blob/py5/mouth.py) - it has a fill feature. However, once the draw method is called from the emoji class, then the entire face gets filled in black. Is there a way to go around this? I'm facing this issue in other files too. I tried moving the fill feature but that's not working

Thanks in advance!

@hx2A
Copy link
Collaborator

hx2A commented Aug 10, 2022

I haven't run your code, but I am guessing you need to use py5.no_fill() after drawing the arc in openMouth()? The no_fill() method is how you turn off the filling of shapes.

I will also note that arc() can be influence by ellipse_mode(). It changes how the arc gets filled in, if at all.

@marziabil
Copy link
Author

Just tried that. The issue then is that the rest of the emoji is white too :(

@hx2A
Copy link
Collaborator

hx2A commented Aug 11, 2022

When you call no_fill() or fill(), it affects all drawing commands that come after that. It doesn't matter if the Sketch is moving in and out of functions. It doesn't get reset when the function exits.

One recommendation is that at the beginning of each function, you set the fill to what you want it to be for that function. Then you know it will be correct for that function and you don't have to worry about if the Sketch will change if you call the functions in a different order.

Another approach is to use push_style() and pop_style() at the beginning and end of each function that sets the fill to something other than the default. Then the fill setting will be reset to the previous setting after the call to pop_style().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants