Last active
August 22, 2016 07:04
-
-
Save OrenBochman/b4d5f3988155453c5bb050f496860b09 to your computer and use it in GitHub Desktop.
polymer neon - hero animation
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
<link rel="import" href="../../neon-shared-element-animatable-behavior.html"> | |
<dom-module id="x-card"> | |
<template> | |
<style> | |
:host { | |
display: block; | |
overflow: hidden; | |
} | |
#placeholder { | |
opacity: 0; | |
background-color: grey; | |
@apply(--layout-fit); | |
} | |
</style> | |
<div id="placeholder"></div> | |
<div id="container"> | |
<content select="div"></content> | |
</div> | |
</template> | |
</dom-module> | |
<script> | |
(function() { | |
Polymer({ | |
is: 'x-card', | |
behaviors: [ | |
Polymer.NeonSharedElementAnimatableBehavior | |
], | |
properties: { | |
animationConfig: { | |
value: function() { | |
return { | |
'entry': [{ | |
name: 'ripple-animation', | |
id: 'ripple', | |
toPage: this | |
}, { | |
name: 'fade-out-animation', | |
node: this.$.placeholder, | |
timing: { | |
delay: 250 | |
} | |
}, { | |
name: 'fade-in-animation', | |
node: this.$.container, | |
timing: { | |
delay: 50 | |
} | |
}], | |
'exit': [{ | |
name: 'fade-out-animation', | |
node: this.$.container, | |
timing: { | |
duration: 0 | |
} | |
}, { | |
name: 'reverse-ripple-animation', | |
id: 'reverse-ripple', | |
fromPage: this | |
}] | |
}; | |
} | |
}, | |
sharedElements: { | |
value: function() { | |
return { | |
'ripple': this.$.placeholder, | |
'reverse-ripple': this.$.placeholder | |
}; | |
} | |
} | |
} | |
}); | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment