Skip to content

Instantly share code, notes, and snippets.

@koganei
Created November 7, 2015 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koganei/8cfa8cc61bec2abc3f0d to your computer and use it in GitHub Desktop.
Save koganei/8cfa8cc61bec2abc3f0d to your computer and use it in GitHub Desktop.
import $ from 'jquery';
import { angular } from './../../js/base';
import _ from 'lodash';
class unlockAnimation {
constructor($element, $rootScope) {
this.$rootScope = $rootScope;
this.listeners = {
click: this.onClick.bind(this),
DOMNodeRemoved: this.onDestroy.bind(this)
};
$($element).on(this.listeners);
}
onClick(event) {
this.executeResizeAnimation();
}
executeResizeAnimation() {
var windowHeight = window.innerHeight;
var deviceHeight = $('#phone-hardware').find('.marvel-device').innerHeight();
var ratio = windowHeight / deviceHeight;
var text = `scale(${ratio*1.25})`;
console.log(`wd: ${windowHeight}, ${deviceHeight}, scale(${ratio})`);
var width = $('#phone-hardware').find('.marvel-device').innerWidth()*2;
$('body').css({transform: text, width: width+25});
this.screenUnlockSource = 'images/lockscreen-password.gif';
this.$rootScope.isScreenUnlocked = true;
}
onDestroy() {
console.log('destroyed');
this.listeners.forEach($($element).off);
}
}
angular.module('unlockanimation', [])
.directive('unlockAnimation', function() {
return {
restrict: 'A',
controller: unlockAnimation,
bindToController: true,
controllerAs: 'unlockAnimation'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment