Skip to content

Instantly share code, notes, and snippets.

Avatar

Jordan Dobson jordandobson

View GitHub Profile
View Test Onboarding
var s = document.createElement("script"); s.setAttribute("src", "https://magic-motion-intro.koenbok.now.sh/MagicMotionIntro.d93f8ba0.js");document.body.appendChild(s);
@jordandobson
jordandobson / xmlToJson.js
Created Aug 28, 2018 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
View xmlToJson.js
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) { // element
// do attributes
if (xml.attributes.length > 0) {
@jordandobson
jordandobson / getBoundingLayerForRotatedLayer.coffee
Last active Jul 7, 2017
Get Bounding Layer for Rotated Layer
View getBoundingLayerForRotatedLayer.coffee
getBoundingLayerForRotatedLayer = (layer) ->
tr = "topRight"; bl = "bottomLeft"; tl = "topLeft"; br = "bottomRight";
center = x: layer.midX, y: layer.midY
size = w: layer.width, h: layer.height
rotation = layer.rotation
corners =
"#{tr}": x: (size.w/2), y: (size.h/2)
"#{bl}": x: -(size.w/2), y: -(size.h/2)
getRotatedPoint = (p) ->
@jordandobson
jordandobson / triangle.coffee
Last active Feb 26, 2018
Creating a triangle via Framer Layer
View triangle.coffee
# Project Info
# This info is presented in a widget when you share.
# http://framerjs.com/docs/#info.info
Framer.Info =
title: "Triangle Layer Rebound"
author: "Jordan Dobson"
twitter: "jordandobson"
description: "jordandobson@gmail.com\n\nThis rebound of jrdn.io/haJ2 \nby Black Ray adds direction checking, allows you to set direction as an option when creating a layer and sets the bounding box of the layer to it's intrinsic size."
View Full Height & width background video or image
Set inline width & height.
Video, img alternative natural width & height: 1920 x 1080
21mb video O_O
http://codepen.io/MikeMcChillin/pen/wKGFz
View gist:e6b39f9454452a615960
- (UIView *)applyBlurToView:(UIView *)view withEffectStyle:(UIBlurEffectStyle)style andConstraints:(BOOL)addConstraints {
//only apply the blur if the user hasn't disabled transparency effects
if (!UIAccessibilityIsReduceTransparencyEnabled()) {
UIBlurEffect * blurEffect = [UIBlurEffect effectWithStyle:style];
UIVisualEffectView * blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
blurEffectView.frame = view.bounds;
[view addSubview:blurEffectView];
blurEffectView.layer.opacity = 0;
if (addConstraints) {
//add auto layout constraints so that the blur fills the screen upon rotating device
@jordandobson
jordandobson / gist:852c4c6ef5e19966ee1a
Created Jun 10, 2015
Objective-c Apply Blending mode to an image
View gist:852c4c6ef5e19966ee1a
- (UIImage *)createDimImage:(UIImage *)image; {
CGSize size = image.size;
CGRect bounds = CGRectMake(0, 0,size.width, size.height);
UIImage * dimImage;
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f);
[msColorNeutralLight setFill];
UIRectFill(bounds);
[image drawInRect:bounds blendMode:kCGBlendModeMultiply alpha:1.0f];
View qc-framer.js
var QcValueConverter = {
tensionFromQcValue: function(qcValue) {
return (qcValue - 30.0) * 3.62 + 194.0;
},
qcValueFromTension: function(tension) {
return (tension - 194.0) / 3.62 + 30.0;
},
frictionFromQcValue: function(qcValue) {
View defaults and helper
# DEFAULTS #####################################################################################################
document.body.addEventListener('touchmove', (e) -> e.preventDefault() );
######################################################################################################################
# HELPER METHODS #####################################################################################################
######################################################################################################################
getComponent = (layer, parentLayer, opts) ->
c = layer.copy()
c.visible = true