appear-animation
Advanced tools
Comparing version 0.0.3 to 1.0.0
74
index.js
@@ -1,51 +0,59 @@ | ||
const forEach = require('lodash/forEach'); | ||
const OnAppear = require('on-appear'); | ||
var OnAppear = require('on-appear'); | ||
class Base { | ||
constructor() { | ||
this.delay = 0; | ||
this.offset = 0; | ||
this.instances = []; | ||
var extend = function(obj, props) { | ||
var newObj = Object.create(obj); | ||
for(var prop in props) { | ||
if(props.hasOwnProperty(prop)) { | ||
newObj[prop] = props[prop]; | ||
} | ||
} | ||
init() { | ||
const els = this.elements; | ||
return newObj; | ||
}; | ||
forEach(els, (el) => { | ||
var AppearAnimation = { | ||
delay: 0, | ||
offset: 0, | ||
instances: [], | ||
elements: [], | ||
create: function(obj) { | ||
return extend(this, obj); | ||
}, | ||
init: function() { | ||
for (var i = 0; i < this.elements.length; i++) { | ||
var el = this.elements[i]; | ||
this.prepare(el); | ||
this.register(el); | ||
}); | ||
} | ||
} | ||
}, | ||
get elements() { | ||
prepare: function() { | ||
// To implement | ||
} | ||
}, | ||
prepare() { | ||
run: function(el) { | ||
// To implement | ||
} | ||
}, | ||
run(el) { | ||
// To implement | ||
} | ||
register(el) { | ||
const instance = new OnAppear(el, { | ||
register: function(el) { | ||
var _this = this; | ||
var instance = new OnAppear(el, { | ||
delay: this.delay, | ||
offset: this.offset, | ||
callback: () => { | ||
this.run(el); | ||
callback: function() { | ||
_this.run(el); | ||
} | ||
}); | ||
}, | ||
this.instances.push(instance); | ||
destroy: function() { | ||
for (var i = 0; i < this.instances.length; i++) { | ||
this.instances[i].destroy(); | ||
} | ||
} | ||
}; | ||
destroy() { | ||
forEach(this.instances, (instance) => { | ||
instance.destroy(); | ||
}); | ||
} | ||
} | ||
module.exports = Base; | ||
module.exports = AppearAnimation; |
{ | ||
"name": "appear-animation", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"dependencies": { | ||
"lodash": "^4.11.1", | ||
"on-appear": "^1.0.2" | ||
"on-appear": "^1.0.3" | ||
}, | ||
@@ -10,0 +9,0 @@ "scripts": { |
@@ -1,1 +0,20 @@ | ||
# appear-animation | ||
# appear-animation | ||
Fade Up example | ||
``` | ||
var FadeUp = AppearAnimation.create({ | ||
delay: 250, | ||
elements: document.querySelectorAll('.card'), | ||
prepare: function(el) { | ||
TweenLite.set(el, { opacity: 0, y: 100 }); | ||
}, | ||
run: function(el) { | ||
TweenLite.to(el, 0.5, { opacity: 1, y: 0 }); | ||
} | ||
}); | ||
FadeUp.init(); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2968
1
48
1
21
- Removedlodash@^4.11.1
- Removedlodash@4.17.21(transitive)
Updatedon-appear@^1.0.3