Skip to content

Instantly share code, notes, and snippets.

@altti0
Forked from sollmo/scrollComp.coffee
Created March 31, 2017 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save altti0/cfa0a7b73ebf4787328595c452444aa5 to your computer and use it in GitHub Desktop.
Save altti0/cfa0a7b73ebf4787328595c452444aa5 to your computer and use it in GitHub Desktop.
example Scroll Component
background = new BackgroundLayer
backgroundColor: '#333'
scroll = new ScrollComponent (width:300, height:300, borderRadius: 6, backgroundColor:'#111')
scroll.center()
for i in [0..5]
layer = new Layer
parent: scroll.content
width: scroll.width - 40
height: scroll.height / 3
x: 20
y: (scroll.height / 3 + 20 ) * i
backgroundColor: '#fff'
borderRadius: 4
name: "card"+i
scroll.scrollHorizonal = false #왜 안먹히지
scroll.contentInset = top:20
scroll.states =
second:
height: 600
y: scroll.y-100
scroll.states.animationOptions = curve: 'spring(250, 25, 0)'
button = new Layer
width:300
height:120
borderRadius: 6
backgroundColor:'#red'
y: 100
html: "<Br>Click to resize a scroll compoent"
button.centerX()
button.style =
color: "#fff"
fontSize: "24px"
fontFamily: "Calibri, Arial, sans-serif"
fontWeight: "bold"
lineHeight: "28px"
textAlign: "center"
button.on Events.Click, ->
scroll.stateCycle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment