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
// Set up our views | |
myStream = new View({x: 0, y: 0, width: 320, height: 568}) | |
myStory = new View({ | |
x: 10, | |
y: 10, | |
width: 300, | |
height: 160, | |
html: "Hello world" | |
}) |
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
var picRef = new ImageView({ | |
x:100, | |
y:100, | |
width:400, | |
height:300, | |
image: "http://distilleryimage7.ak.instagram.com/310adf44426011e38fa722000a9f1885_8.jpg" | |
}); | |
var turnLeft_BTN = new View({ | |
x:4, |
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
//DEMO: drag the childView inside the box and click the view outside to send it to the relative location of the inner one. | |
// set up three views, one to hold a child and two that match except for their superViews | |
parentView = new View({x: 100, y:100, width: 300, height: 300}) | |
childView = new View({x: 20, y: 20, width: 60, height: 40, superView: parentView}) | |
cousinView = new View(childView) | |
cousinView.superView = parentView.superView | |
childView.dragger = new ui.Draggable(childView) | |
cousinView.on("click", function(){ |
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
/// Test view setup | |
view = new View({x:50,y:50,width:100,height:100}) | |
// Define the functions to cycle through | |
// Create cycle variables. | |
var scales = utils.cycle(.3, .6, 1, 1.3, 1, .6) | |
var coords = utils.cycle({x: 250, y:50}, {x: 250, y:250}, {x: 50, y:250}, {x:50, y:50}) | |
var rotations = utils.cycle(-90,45,-110,180,0) |
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
function convertRange(OldMin, OldMax, OldValue, NewMin, NewMax){ | |
var OldRange = OldMax - OldMin; | |
var NewRange = NewMax - NewMin; | |
return (((OldValue - OldMin) * NewRange) / OldRange) + NewMin; | |
} | |
newOpacity = convertRange(0, 10, 3, 0, 100) | |
console.log (newOpacity) |
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
// Simple get child function by partial name match | |
// useful for photoshop files with repeated layer group naming | |
function getChildView(view, needle){ | |
haystack = view.subViews | |
for (var hay in haystack){ | |
if (haystack[hay].name.indexOf(needle) !== -1){ | |
return view.subViews[hay] | |
} | |
} | |
} |
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
cell = new View({ | |
x: 0, | |
y: 300, | |
width: 640, | |
height: 100 | |
}); | |
cell.dragger = new ui.Draggable(cell); | |
cell.animated = false; | |
cell.on(Events.DragMove, function() { |
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
// Set up the views. One big view and several smaller views. I'm using a shortcut to make all the subViews the same as the first | |
parentViewA = new View({x:10,y:10,width:500,height:500}) | |
subView1 = new View({x:0,y:0,width:50,height:50}) | |
subView1.superView = parentViewA | |
subView2 = new View(subView1) | |
subView3 = new View(subView1) | |
subView4 = new View(subView1) | |
subView5 = new View(subView1) | |
subView6 = new View(subView1) |
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
for (var layerGroupName in PSD) { | |
view = PSD[layerGroupName]; | |
// Change FramerPager here to your keyword | |
if (view.name.indexOf("FramerPager") != -1){ | |
// do something with that thing! | |
// one idea is to add it to an array for access later | |
// or you cold set their css style, set their positions, whatever | |
// in the demo below I make a new FramerPager for it so it… pages | |
} | |
} |
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
@mixin responsive-block($breakpoint: null) | |
@if $breakpoint == wide | |
@media only screen and (min-width: 1280px) | |
@content | |
@if $breakpoint == ipad-landscape | |
@media only screen and (min-width: 1024px) and (max-width: 1124px) | |
@content | |
@if $breakpoint == ipad-portrait | |
@media only screen and (min-width: 768px) and (max-width: 1024px) | |
@content |
NewerOlder