Skip to content

Commit

Permalink
fix(Effects): Reverting fix final opacity value on fade method
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaperret committed Aug 10, 2017
1 parent 8e76bdb commit a457b58
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
* @param {boolean} isFadeIn Determine fadeIn or fadeOut
*/
function fade (element, duration = 400, isFadeIn) {
const opacity = isFadeIn ? 0 : 1
element.style.opacity = opacity
element.style.opacity = isFadeIn ? 0 : 1

let last = +new Date()
function tick () {
Expand All @@ -24,8 +23,6 @@ function fade (element, duration = 400, isFadeIn) {
const targetOpacity = isFadeIn ? +element.style.opacity < 1 : +element.style.opacity > 0
if (targetOpacity) {
(window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16)
} else {
element.style.opacity = isFadeIn ? 1 : 0
}
}

Expand Down

0 comments on commit a457b58

Please sign in to comment.