Skip to content

Instantly share code, notes, and snippets.

@steveruizok
Created April 18, 2018 12:44
Show Gist options
  • Save steveruizok/a65b24fa864a5a982d30e0540721d88b to your computer and use it in GitHub Desktop.
Save steveruizok/a65b24fa864a5a982d30e0540721d88b to your computer and use it in GitHub Desktop.
# Transitions
# Compiled by @myvo, packaged up by @steveruizok
#
# Usage
#
# - Drop this file in your project's modules folder.
#
# - At the top of your project, include:
# Transitions = require "Transitions"
#
# - Use the transitions in your flow component:
# flow.transition(layer, Transitions.slideOutRight)
#
# - Need to quickly review all the transitions in this module? Try:
# print _.keys(Transitions)
exports.switchInstant = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:0
layerB:
show:
x:0
y:0
hide:
x:0
y:0
exports.slideInUp = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:0
layerB:
show:
x:0
y:0
hide:
x:0
y:Screen.height
exports.slideInDown = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:0
layerB:
show:
x:0
y:0
hide:
x:0
y:-Screen.height
exports.slideInLeft = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:0
layerB:
show:
x:0
y:0
hide:
x:-Screen.width
y:0
exports.slideInRight = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:0
layerB:
show:
x:0
y:0
hide:
x:Screen.width
y:0
exports.slideOutDown = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:Screen.height
layerB:
show:
x:0
y:0
height: Screen.height
hide:
x:0
y:0
height:0
exports.slideOutRight = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:Screen.width
y:0
layerB:
show:
x:0
y:0
width:Screen.width
hide:
x:0
y:0
width:0
exports.moveInUp = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:-Screen.height
layerB:
show:
x:0
y:0
hide:
x:0
y:Screen.height
exports.moveInDown = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:0
y:Screen.height
layerB:
show:
x:0
y:0
hide:
x:0
y:-Screen.height
exports.moveInLeft = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:Screen.width
y:0
layerB:
show:
x:0
y:0
hide:
x:-Screen.width
y:0
exports.moveInRight = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:-Screen.width
y:0
layerB:
show:
x:0
y:0
hide:
x:Screen.width
y:0
exports.pushInLeft = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:Screen.width / 2
y:0
layerB:
show:
x:0
y:0
shadowX: 0
shadowColor: 'rgba(0,0,0,0.6)'
hide:
x:-Screen.width
y:0
shadowX: Screen.width
shadowColor: 'rgba(0,0,0,0)'
exports.pushInRight = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:-Screen.width / 2
y:0
layerB:
show:
x:0
y:0
shadowX: 0
shadowColor: 'rgba(0,0,0,0.6)'
hide:
x:Screen.width
y:0
shadowX: -Screen.width
shadowColor: 'rgba(0,0,0,0)'
exports.pushOutRight = (nav, layerA, layerB, overlay) ->
transition =
layerA:
show:
x:0
y:0
hide:
x:Screen.width
y:0
layerB:
show:
x:0
y:0
width:Screen.width
shadowX: Screen.width
shadowColor: 'rgba(0,0,0,0)'
shadowType: 'inner'
hide:
x:-Screen.width / 2
y:0
width:Screen.width/2
shadowX: Screen.width
shadowColor: 'rgba(0,0,0,0.6)'
shadowType: 'inner'
exports.fadeIn = (nav, layerA, layerB, overlay) ->
transition =
layerB:
show:
x:0
y:0
opacity: 1
hide:
x:0
y:0
opacity: 0
exports.zoomIn = (nav, layerA, layerB, overlay) ->
transition =
layerB:
show:
x:0
y:0
scale: 1
opacity: 1
hide:
x:0
y:0
scale: .9
opacity: 0
exports.zoomOut = (nav, layerA, layerB, overlay) ->
transition =
layerB:
show:
x:0
y:0
scale: 1
opacity: 1
hide:
x:0
y:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment