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

'Circle' type not in center #88

Open
xilibro opened this issue Nov 9, 2017 · 3 comments
Open

'Circle' type not in center #88

xilibro opened this issue Nov 9, 2017 · 3 comments

Comments

@xilibro
Copy link

xilibro commented Nov 9, 2017

image
image
as you can see, not totally in center, how can i fix this issure

@xilibro
Copy link
Author

xilibro commented Nov 9, 2017

image

@xilibro
Copy link
Author

xilibro commented Nov 9, 2017

I do not know how to add a new pull request, so i put the solved code here.
in animations/RTSpinKitCircleAnimation.m, i changed the following code:
`

CGFloat radius = size.width / 2; 
CGFloat circleSize = size.width / 4;
CGFloat circleRadius = circleSize / 2; // added by xilibro 2017-11-09 15:39:59

for (NSInteger i=0; i < 8; i+=1) {
    CALayer *circle = [CALayer layer];

    CGFloat angle = i * M_PI_4; // M_PI_4 = 45°
    CGFloat x = radius + sinf(angle) * radius - circleRadius; // altered by xilibro 2017-11-09 
    CGFloat y = radius - cosf(angle) * radius - circleRadius; // altered by xilibro
   ... ...

`
minus circleself's radius solved the issure.
RTSpinKitFadingCircleAnimation.m use the same way to solve issure

@xilibro xilibro changed the title Cycle type not in center 'Circle' type not in center Nov 9, 2017
@wumke
Copy link

wumke commented Feb 26, 2019

I also noticed that, only in iOS, the circle is shifted slightly to the right.
I used fadingCircleAlt and substracted CGFloat circleRadius = size.width / 16; from x and y of the frame.

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