Skip to content

Instantly share code, notes, and snippets.

@stangrinapol
Last active August 29, 2015 14:11
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 stangrinapol/3fcd2da6e73dc4cb464b to your computer and use it in GitHub Desktop.
Save stangrinapol/3fcd2da6e73dc4cb464b to your computer and use it in GitHub Desktop.
I am trying to create a google material style drill down in framer, how do I add text to my list items. I am stuck at line 43
# This imports all the layers for "icons" into iconsLayers
Background = new BackgroundLayer backgroundColor: "#f6f6f6"
#assign number of list items within each level of the list
cellCount = 10
cellTwoCount = 10
CellThreeCount = 10
CellFourCount = 10
# Placing all fields within a container
Container = new Layer backgroundColor: "transparent", width:1080, height:2000
Container.center()
#Container.style.padding = "10px 0 0 0 "
# 10 Fields
for colNumber in [0...cellCount]
Field = new Layer
width:1080
height:240
backgroundColor: "#fff"
shadowY: 2
shadowBlur: 5
borderRadius: 6
y: (colNumber) * 242
bug = new Layer
x:972
width:92
height:72
backgroundColor: "#d6dbdd"
borderRadius:80
y: (colNumber) * 250
badge = new Layer
x:16
width:160
height:160
backgroundColor: "#d6dbdd"
y: (colNumber) * 250
# How do I cycle through 10 buttons to add text.
Field.shadowColor = "rgba(0, 0, 0, 0.25)"
Field.superLayer = Container
bug.superLayer = Container
badge.superLayer = Container
Field.centerX()
# Each field gets its own Highlight and Shadow animation
Field.on Events.Click, (event, Field) ->
#console.log "fire1"
Field.bringToFront()
# Create a subset of list items so that when the user clicks on a lsit item it will reveal the child list
for newColNumber in [0...cellTwoCount]
SecondaryField = new Layer
width:1080
height:240
backgroundColor: "#fff"
shadowY: 2
shadowBlur: 5
borderRadius:6
y: (newColNumber) * 246
SecondaryField.shadowColor = "rgba(0, 0, 0, 0.25)"
SecondaryField.superLayer = Field
SecondaryField._prefer2d = true
# secondary field gets its own Highlight and Shadow animation
SecondaryField.on Events.Click, (event, SecondaryField) ->
#console.log "fire2"
event.stopPropagation()
SecondaryField.bringToFront()
# Create a subset of list items so that when the user clicks on a lsit item it will reveal the child list
for tertiaryColNumber in [0...CellThreeCount]
TertiaryField = new Layer
width:1080
height:240
backgroundColor: "#ffffff"
shadowY: 2
shadowBlur: 5
borderRadius:6
y: (tertiaryColNumber) * 244
TertiaryField.superLayer = SecondaryField
TertiaryField._prefer2d = true
TertiaryField.shadowColor = "rgba(0, 0, 0, 0.25)"
secondaryFieldAnimation = SecondaryField.animate
properties:
opacity: 1, shadowY: 10, shadowBlur: 16
curve: "ease", time: .1
# Reset scale and reveal secondary content
secondaryFieldAnimation.on "end" , ->
SecondaryField.animate
properties:
y: 0, height: 2000,
curve: "ease", time: 0.1
# This is supposed to be a round highlight but at the moment it's failing, strange enough it works if I remove Secondary Field
Highlight = new Layer
width:10, height:10, backgroundColor: "#eeeeee", borderRadius: "50%", opacity:0
Highlight.superLayer = Field
Highlight._prefer2d = true
# Matching the Highlight position with the click position
Highlight.x = event.clientX - Container.x - Field.x - (Highlight.width / 2)
Highlight.y = event.clientY - Container.y - Field.y - (Highlight.height / 2)
highlightAnimation = Highlight.animate
properties:
width: Field.width + 40, height: 1080, opacity: 1, x: -10 , y: Field.height/2 # Half of new height & half of Cursor height
curve: "ease", time: 0.25
# Fade & Reset Highlight
highlightAnimation.on "end" , ->
Highlight.animate
properties:
opacity: 0
curve: "ease", time: 0.1
utils.delay 0.1, ->
# Resetting the Highlight properties
Highlight.width = 160
Highlight.height = 160
# Animate Shadow
fieldAnimation = Field.animate
properties:
opacity: 1, shadowY: 10, shadowBlur: 16
curve: "ease", time: .1
# Reset scale and reveal secondary content
fieldAnimation.on "end" , ->
Field.animate
properties:
y: 0, height: 2000,
curve: "ease", time: 0.1
# Create Layers
actionBar = new Layer({x:0, y:0, width:1080, height:162, backgroundColor: "#222222" })
taskBar = new Layer({x:0, y:0, width:1080, height:50, backgroundColor: "#222222" })
# Create html layer with styling
actionbarTimer = new Layer({x:950, y:-20, width:1080, height:60, backgroundColor: "null" })
actionbarTimer.html = "12:00"
actionbarTimer.style = fontSize: '32px', fontWeight: 400, lineHeight: '88px', color: 'white'
# This imports all the layers for "icons" into iconsLayers,
# This is hardcoded it would be nice to make it dynamic
iconsLayers = Framer.Importer.load "imported/icons"
iconsLayers. y = 10
iconsLayers.signal.x = 800
iconsLayers.signal.y = 10
iconsLayers.strength.x = 850
iconsLayers.strength.y = 10
iconsLayers.charge.x = 900
iconsLayers.charge.y = 10
iconsLayers.test.height = 4000
iconsLayers.test.y = 400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment