Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. class Pill extends Layer
  2. constructor: (options) ->
  3. super _.defaults options,
  4. height: 26
  5. width: 156
  6. borderRadius: 13
  7. color: 'white'
  8. html: 'Pill_name'
  9. style:
  10. 'font-size': '14px'
  11. 'font-weight': 'bold'
  12. 'padding': '0 8px 0 12px'
  13. 'line-height': '26px'
  14.  
  15. @type('string')
  16.  
  17. type: (type) ->
  18. switch type
  19. when 'string' then @.backgroundColor = '54C7EC'
  20. when 'number' then @.backgroundColor = '6BCEBB'
  21. when 'unknown' then @.backgroundColor = '90949C'
  22. when 'calcuated' then @.backgroundColor = '4B4F56'
  23.  
  24. pills = []
  25.  
  26. Utils.delay 2, ->
  27. for i in [1..10]
  28. offset = 4
  29. pillHeight = 26
  30. pill = new Pill
  31. x: Align.center(-50)
  32. opacity: 0
  33. y: 300 + (offset * i) + (pillHeight * i)
  34. animate:
  35. x: Align.center
  36. options:
  37. curve: 'spring(400, 40, 0)'
  38.  
  39. pill.type(Utils.randomChoice [
  40. 'string',
  41. 'number',
  42. 'unknown',
  43. 'calculated'
  44. ])
  45.  
  46. pills.push pill
  47.  
  48. for layer, index in pills
  49. layer.animate
  50. delay: index * 0.05
  51. properties:
  52. x: Align.center
  53. opacity: 1
  54. options:
  55. curve: 'spring(400, 20, 0)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement