performance - In Swift is there a difference between the rotation in these two scenarios -


example 1:

            let halfpie = double.pi / 2             var piecount: int = 0               let rotationnum = (piecount % 4) + 1             let angle = halfpie * double(rotationnum)             uiview.animate(withduration: 1, animations: { [weak self] in                 self?.containerview.transform = cgaffinetransform(rotationangle: cgfloat(angle))             }) { [weak self] _ in                 self?.piecount += 1             } 

example 2:

            let halfpie = 1.5707963267949             var piecount: int = 1               let angle = halfpie * double(piecount)             uiview.animate(withduration: 1, animations: { [weak self] in                 self?.containerview.transform = cgaffinetransform(rotationangle: cgfloat(angle))             }) { [weak self] _ in                 self?.piecount += 1             } 

the difference between 2 second continues increase, , first keeps number max @ pie * 2. there reason impliment 1 way on other? both seem same thing. piecount initialized globally.

there no difference.

if animate 180° or 540°, animation same since view least amount of movement correct position.


on side note, shouldn't hardcoding halfpie should use double.pi/2


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -