Forked from RayPS/Framer-Make-CSS-Triangle.coffee
Last active
September 26, 2016 21:09
-
-
Save isaacw/9f7b6154ce231852afb52bde2ef13801 to your computer and use it in GitHub Desktop.
Turn layer into a CSS-bassed triangle
This file contains hidden or 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 | |
# CSS Based triangles | |
# Directions: "top", "right", "bottom", "left" | |
# Credit: Black Ray https://gist.github.com/RayPS/9460d020b59fe7a201da65207bb369a0 | |
Layer::makeTriangle = (direction)-> | |
@.borderColor = "transparent" | |
@.borderWidth = @.width / 2 | |
@.style["border-#{direction}-color"] = @.backgroundColor.toHexString() | |
@.backgroundColor = "transparent" | |
# ---------- | |
rect = new Layer | |
size: 20 | |
backgroundColor: "black" | |
point: Align.center | |
rect.makeTriangle "bottom" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment