react-reveal-fx
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -16,2 +16,6 @@ /// <reference types="react" /> | ||
}; | ||
overlayContent?: { | ||
delay: number; | ||
content: JSX.Element; | ||
}; | ||
} | ||
@@ -25,2 +29,3 @@ export interface RevealFxState { | ||
revealer: HTMLDivElement; | ||
overlayContent: HTMLDivElement; | ||
constructor(props: RevealFxProps); | ||
@@ -27,0 +32,0 @@ componentDidMount(): void; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -19,4 +20,5 @@ var extendStatics = Object.setPrototypeOf || | ||
}; | ||
import * as React from 'react'; | ||
import * as anime from 'animejs'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var React = require("react"); | ||
var anime = require("animejs"); | ||
var RevealFx = (function (_super) { | ||
@@ -63,3 +65,9 @@ __extends(RevealFx, _super); | ||
} | ||
} }))); | ||
} }, (this.props.overlayContent) && (React.createElement("div", { className: "block-revealer__overlayContent", style: { | ||
opacity: 0 | ||
}, ref: function (ref) { | ||
if (!!ref) { | ||
_this.overlayContent = ref; | ||
} | ||
} }, !!this.props.overlayContent && this.props.overlayContent.content))))); | ||
}; | ||
@@ -123,2 +131,3 @@ RevealFx.prototype.getTransformSettings = function (direction) { | ||
var self = this; | ||
var overlayContent = this.props.overlayContent; | ||
var animationSettings2 = { | ||
@@ -128,2 +137,8 @@ targets: self.revealer, | ||
easing: revealSettings.easing || defaults.easing, | ||
delay: (!!overlayContent) ? overlayContent.delay : 0, | ||
begin: function () { | ||
if (!!overlayContent) { | ||
self.overlayContent.style.opacity = '0'; | ||
} | ||
}, | ||
complete: function () { | ||
@@ -147,2 +162,5 @@ self.setState({ isAnimating: false }); | ||
} | ||
if (!!overlayContent) { | ||
self.overlayContent.style.opacity = '1'; | ||
} | ||
anime(__assign({}, animationSettings2)); | ||
@@ -168,2 +186,2 @@ }, | ||
}(React.Component)); | ||
export default RevealFx; | ||
exports.default = RevealFx; |
@@ -5,3 +5,3 @@ { | ||
"authors": "igorrmotta", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "./build/RevealFx.js", | ||
@@ -20,2 +20,2 @@ "types": "./build/RevealFx.d.ts", | ||
} | ||
} | ||
} |
18897
482