Skip to content

Commit

Permalink
Make size optional for Utils.randomImage
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed May 11, 2016
1 parent 6e06e20 commit decc0c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions framer/Utils.coffee
Expand Up @@ -147,10 +147,12 @@ Utils.randomNumber = (a=0, b=1) ->
# Return a random number between a and b
Utils.mapRange Math.random(), 0, 1, a, b

Utils.randomImage = (layer, offset=50) ->
Utils.randomImage = (size, offset=50) ->

width = Utils.round(layer.width, 0, 100, 100)
height = Utils.round(layer.height, 0, 100, 100)
size ?= {width:800, height:600}

width = Utils.round(size.width, 0, 100, 100)
height = Utils.round(size.height, 0, 100, 100)

# return "https://source.unsplash.com/category/nature/#{width}x#{height}"
return "https://unsplash.it/#{width}/#{height}?image=#{layer.id + offset}"
Expand Down

0 comments on commit decc0c0

Please sign in to comment.