Permalink
Browse files

Nice color gradient for GridComponent

  • Loading branch information...
koenbok committed Jun 1, 2016
1 parent f508b18 commit 5cc7331a0c92f55b251e56e2ddc76cf6164285d2
Showing with 11 additions and 3 deletions.
  1. +2 −1 framer/Color.coffee
  2. +9 −2 framer/Components/GridComponent.coffee
@@ -618,7 +618,8 @@ stringToObject = (color) ->
cssNames =
aliceblue:"f0f8ff"
antiquewhite:"faebd7"
aqua:"0ff",aquamarine:"7fffd4"
aqua:"0ff"
aquamarine:"7fffd4"
azure:"f0ffff"
beige:"f5f5dc"
bisque:"ffe4c4"
@@ -76,17 +76,24 @@ class exports.GridComponent extends Layer
for row in [@rows-1..0]
for column in [@columns-1..0]
frame = @cellFrame(column, row)
# frame.x = Math.floor(frame.x)
# frame.y = Math.floor(frame.y)
# frame.width = Math.ceil(frame.width)
# frame.height = Math.ceil(frame.height)
cell = new Layer
parent: @
frame: @cellFrame(column, row)
frame: frame
name: "Cell #{column}:#{row}"
@renderCell(cell, row, column)
@_cells["#{column}:#{row}"] = cell
_defaultRenderCell: (cell, column, row) ->
cell.backgroundColor = Utils.randomColor()
fraction = ((column / @columns) + (row / @rows) / 2)
cell.backgroundColor = Color.mix("blue", "purple", fraction, true, "rgb")
Utils.labelLayer(cell, "#{row}:#{column}")
_reset: ->

0 comments on commit 5cc7331

Please sign in to comment.