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
| ### | |
| ViewController transitions (https://github.com/awt2542/ViewController-for-Framer) ported to FlowComponent by @myvo | |
| Usage: | |
| Transitions = require "Transitions" | |
| a = new Layer size: Screen.size, html: "A" | |
| b = new Layer size: Screen.size, html: "B" | |
| flow = new FlowComponent | |
| flow.showNext a |
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
| class PageIndicator extends Layer | |
| constructor: (options = {} )-> | |
| _.defaults options, | |
| width: 50 | |
| height: 10 | |
| backgroundColor: "" | |
| borderRadius: "50%" | |
| super options | |
| for i in [0...@amount] |
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
| convertToTextLayer = (layer) -> | |
| t = new TextLayer | |
| name: layer.name | |
| frame: layer.frame | |
| parent: layer.parent | |
| cssObj = {} | |
| css = layer._info.metadata.css | |
| css.forEach (rule) -> | |
| return if _.includes rule, '/*' |
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
| # Shortcut to bring a layer into view. Nice for tweaking properties. | |
| # Usage: btn.centerStage() | |
| Layer::centerStage = (opacity = 1) -> | |
| bg = new Layer size: Screen.size, backgroundColor: 'black', opacity: opacity | |
| @parent = null | |
| @bringToFront() | |
| @midX = Screen.midX | |
| @midY = Screen.midY |
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::isOverlapping = (targetLayer, offset = 0) -> | |
| if @screenFrame.x + @width + offset >= targetLayer.screenFrame.x && | |
| @screenFrame.x - offset <= targetLayer.screenFrame.x + targetLayer.width && | |
| @screenFrame.y + @height + offset >= targetLayer.screenFrame.y && | |
| @screenFrame.y - offset <= targetLayer.screenFrame.y + targetLayer.height | |
| true | |
| else | |
| false | |
| Layer::isInside = (targetLayer, offset = 0) -> |
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
| # Create some boxes with the same name | |
| for i in [0..5] | |
| b = new Layer | |
| name: "box" | |
| y: i*120 | |
| # A function to find and loop through layer names matching your keyword | |
| selectAll = (s, f) -> | |
| for l in Framer.CurrentContext.getLayers() | |
| f.apply(l) if l.name.match(s) |