This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array::stack = (spacing = 0) -> | |
for layer, index in this | |
layer.y = this[index-1]?.maxY | |
layer.y += spacing | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PaddingLabel: UILabel { | |
var topInset: CGFloat | |
var bottomInset: CGFloat | |
var leftInset: CGFloat | |
var rightInset: CGFloat | |
required init(withInsets top: CGFloat, _ bottom: CGFloat,_ left: CGFloat,_ right: CGFloat) { | |
self.topInset = top | |
self.bottomInset = bottom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put font files to Xcode project. | |
// Add this properties to Info.plist: | |
// Fonts provided by application | |
// Item 0: SF-Pro-Display-Regular.otf | |
// Item 1: SF-Pro-Display-Bold.otf | |
// Item 2: ... | |
// Tips: To get the list of iOS SDK built-in fonts you can found on http://iosfonts.com | |
// Or type "po [UIFont familyNames]" in Xcode lldb console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd = (a, b, c)-> | |
if a.x < b.x + b.width and | |
a.x + a.width > b.x and | |
a.y < b.y + b.height and | |
a.height + a.y > b.y | |
c() | |
# a: Layer A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
easings = | |
easeIn: "ease-in", | |
easeOut: "ease-out", | |
easeInOut: "ease-in-out", | |
easeInSine: "cubic-bezier(0.47, 0, 0.745, 0.715)", | |
easeOutSine: "cubic-bezier(0.39, 0.575, 0.565, 1)", | |
easeInOutSine: "cubic-bezier(0.445, 0.05, 0.55, 0.95)", | |
easeInQuad: "cubic-bezier(0.55, 0.085, 0.68, 0.53)", | |
easeOutQuad: "cubic-bezier(0.25, 0.46, 0.45, 0.94)", | |
easeInOutQuad: "cubic-bezier(0.455, 0.03, 0.515, 0.955)", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Layer::makeTriangle = (direction)-> | |
this.borderColor = "transparent" | |
this.borderWidth = this.width / 2 | |
this.style["border-#{direction}-color"] = this.backgroundColor.toHexString() | |
this.backgroundColor = "transparent" | |
# ---------- | |
rect = new Layer | |
size: 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is_iPhone = Framer.Device.deviceType.includes "apple-iphone" | |
is_iPhonePlus = Framer.Device.deviceType.includes "plus" | |
is_iPhoneNotPlus = is_iPhone and not is_iPhonePlus | |
if is_iPhonePlus and Utils.isFramerStudio() then Framer.Device.content.scale = 3 | |
if is_iPhoneNotPlus and Utils.isFramerStudio() then Framer.Device.content.scale = 2 | |
document.querySelector("head>meta[name=viewport]").setAttribute "content", | |
"width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no" | |
Framer.Device._update() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
column = 4 | |
count = 19 | |
gutter = 10 | |
cellSize = | |
width: 100 | |
height: 100 | |
for i in [0...count] | |
offsetX = i % column | |
offsetY = Math.floor i / column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img { | |
/* Chrome */ | |
image-rendering: pixelated; | |
/* Safari */ | |
image-rendering: -webkit-crisp-edges; | |
/* Firefox */ | |
image-rendering: -moz-crisp-edges; |