π File Reader
$(function(){
//ιΌ ζ εΎζ
var Cursor = {
position: {
x: 0,
y: 0
},
dom: '',
target: '',
init: function (target, elm) {
this.target = document.querySelector(target);
this.dom = document.querySelector(elm);
this.eventHander()
this.ani()
},
show: false,
dragg: false,
update: function (x, y) {
},
ani: function () {
requestAnimationFrame(Cursor.ani)
Cursor.render()
},
render: function () {
if (Cursor.show) {
/** @type {HTMLElement} */
Cursor.target.classList.add('show-pointer')
TweenMax.to(this.target, .25, {
left: Cursor.position.x + 'px',
top: Cursor.position.y + 'px'
})
} else {
Cursor.target.classList.remove('show-pointer')
}
},
eventHander: function () {
var self = this
this.dom.addEventListener('mousemove', function (e) {
self.position.x = e.clientX
self.position.y = e.clientY
}, false)
this.dom.addEventListener('mousedown', function (e) {
$(self.target).addClass('active')
}, false)
this.dom.addEventListener('mouseup', function (e) {
$(self.target).removeClass('active')
}, false)
this.dom.addEventListener('mouseleave', function (e) {
self.show = false
// console.log('leave')
}, false)
this.dom.addEventListener('mouseenter', function (e) {
self.show = true
// console.log('in')
}, false)
}
}
Cursor.init('.cursor', '.Must')
})