swift3 - animation not working in xcode 8 playground swift 3 -
i trying learn more animations in xcode 8 playground using swift 3. have learned swift no longer uses xcplayground, instead, using "import playgroundsupport".
i can not show in assistant editor. know fix or bug new xcode 8
any awesome. thanks.
import uikit import playgroundsupport let containerview = uiview(frame: cgrect(x: 0.0, y: 0.0, width: 375.0, height: 667.0)) playgroundpage.current.needsindefiniteexecution = true playgroundpage.current.liveview = containerview let circle = uiview(frame: cgrect(x: 0.0, y: 0.0, width: 50.0, height: 50.0)) circle.center = containerview.center circle.layer.cornerradius = 25.0 let startingcolor = uicolor(red: (253.0/255.0), green: (159.0/255.0), blue: (47.0/255.0), alpha: 1.0) circle.backgroundcolor = startingcolor containerview.addsubview(circle); let rectangle = uiview(frame: cgrect(x: 0.0, y: 0.0, width: 50.0, height: 50.0)) rectangle.center = containerview.center rectangle.layer.cornerradius = 5.0 rectangle.backgroundcolor = uicolor.white containerview.addsubview(rectangle) uiview.animate(withduration: 2.0, animations: { () -> void in let endingcolor = uicolor(red: (255.0/255.0), green: (61.0/255.0), blue: (24.0/255.0), alpha: 1.0) circle.backgroundcolor = endingcolor let scaletransform = cgaffinetransform(scalex: 5.0, y: 5.0) circle.transform = scaletransform let rotationtransform = cgaffinetransform(rotationangle: 3.14) rectangle.transform = rotationtransform })
open assistant editor view live view of animation mentioned in article you're basing off
Comments
Post a Comment