Advertisement
Guest User

Framer Circle Demo

a guest
Jan 11th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. bg = new BackgroundLayer backgroundColor: "#EFEFEF"
  2.  
  3.  
  4. radiusLength = 200
  5. centerPoint = (200 - radius)/2
  6.  
  7. centerCircle = new Layer
  8. width: 200
  9. height: 200
  10. backgroundColor: "#616161"
  11. borderRadius: 100
  12.  
  13. centerCircle.center()
  14. centerCircle.clip = false
  15.  
  16.  
  17. radius = 60
  18. centerPoint = (200 - radius)/2
  19. allCircles = []
  20. numCircles = 8
  21.  
  22. for i in [1..numCircles]
  23. positions = 360 / numCircles
  24. angle = positions * i
  25.  
  26. adjSide = Math.cos(angle * Math.PI/180)*radiusLength
  27. oppSide = Math.sin(angle * Math.PI/180)*radiusLength
  28. adjSide = Utils.round(adjSide, 1)
  29. oppSide = Utils.round(oppSide, 1)
  30.  
  31. circle = new Layer
  32. x: centerPoint
  33. y: centerPoint
  34. superLayer: centerCircle
  35. width:radius
  36. backgroundColor: "#9F9F9F"
  37. height: radius
  38. opacity: 1
  39. borderRadius: radius/2
  40.  
  41. circle.states.add({
  42. out: {y: oppSide+(radius/2), x:adjSide+(radius/2)}
  43. })
  44.  
  45. circle.states.animationOptions = {
  46. curve: "spring(300,20,0)"
  47. delay: 0.1 * i
  48. }
  49.  
  50. allCircles.push circle #add cirlce to an array
  51.  
  52. centerCircle.on Events.Click, ->
  53.  
  54. for i, j of allCircles
  55. j.states.next()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement