Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Make size optional for Utils.randomImage
- Loading branch information
Showing
with
5 additions
and
3 deletions.
-
+5
−3
framer/Utils.coffee
|
@@ -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}" |
|
|