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

Can we apply gradient color to Slice and apply gradient color for Slice's Text? is it possible with some customization? #16

Closed
kishanbh opened this issue May 31, 2021 · 9 comments

Comments

@kishanbh
Copy link

No description provided.

@kishanbh kishanbh changed the title Can we apply gradient color to Slice? it it possible with some customization? Can we apply gradient color to Slice and apply gradient color for Slice's Text? it it possible with some customization? Jun 1, 2021
@kishanbh kishanbh changed the title Can we apply gradient color to Slice and apply gradient color for Slice's Text? it it possible with some customization? Can we apply gradient color to Slice and apply gradient color for Slice's Text? is it possible with some customization? Jun 1, 2021
@sh-khashimov
Copy link
Owner

With some modification, it's possible to apple gradient color to Slice's background. I add this in the future release. However, if you need a fast solution, here is a file that updated for gradient:
Simulator Screen Shot - iPhone 12 - 2021-06-01 at 11 00 40

SliceDrawing.swift.zip

About Text gradient, unfortunately, there is no easy solution.

@kishanbh
Copy link
Author

kishanbh commented Jun 3, 2021

With some modification, it's possible to apple gradient color to Slice's background. I add this in the future release. However, if you need a fast solution, here is a file that updated for gradient:
Simulator Screen Shot - iPhone 12 - 2021-06-01 at 11 00 40

SliceDrawing.swift.zip

About Text gradient, unfortunately, there is no easy solution.

@sh-khashimov can we apply gradient-like marked (radial gradient) in the attached image for the slice and applying for some slice only not all slice in the wheel?
wheel

@kishanbh
Copy link
Author

kishanbh commented Jun 4, 2021

@sh-khashimov do you have any suggestions or thoughts about radial gradient for slice then it will be helpful.

@sh-khashimov
Copy link
Owner

change the code above that I gave you to:

context.drawLinearGradient(
              gradient,
            start: CGPoint(x: path.boundingBox.minX, y: path.boundingBox.midY),
              end: CGPoint(x: path.boundingBox.maxX, y: path.boundingBox.midY),
            options: []
            )
        //MARK: - Gradient Color END

@kishanbh
Copy link
Author

kishanbh commented Jun 4, 2021

@sh-khashimov thanks for the reply but it gives a gradient but from bottom to top like in between colors straight line I want radial like orange marked in the attached image is it possible?
1

@sh-khashimov
Copy link
Owner

instead of context.drawLinearGradient:

        context.drawRadialGradient(gradient,
                                   startCenter: center,
                                   startRadius: 0,
                                   endCenter: center,
                                   endRadius: radius,
                                   options: [])

@kishanbh
Copy link
Author

kishanbh commented Jun 4, 2021

@sh-khashimov got it, thanks for the reply and library. do you have any idea about the slice's text gradient or any file modification?

@sh-khashimov
Copy link
Owner

sh-khashimov commented Jun 4, 2021

Unfortunately, no. Since gradient text is just an image inside the text, which adds complexity for already not an easy text processing inside the SwiftFortuneWheel. If you need to add a gradient text, my current advice, convert text to an image with gradient applied text, then add that image to your Slice.

@kishanbh
Copy link
Author

kishanbh commented Jun 4, 2021

@sh-khashimov thanks for the replay and all your help. Hope, in future version, we have gradient color option for text also

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