Skip to content

Instantly share code, notes, and snippets.

@roeib
Created May 29, 2019 09:13
Show Gist options
  • Save roeib/569d1134b9695fc2a5ba4893ae03f876 to your computer and use it in GitHub Desktop.
Save roeib/569d1134b9695fc2a5ba4893ae03f876 to your computer and use it in GitHub Desktop.
import React from "react";
import { useSpring, animated } from "react-spring";
const FadeFromTopAndcounter = () => {
const fadeFromtop = useSpring({
to: { opacity: 1, marginTop: 0 },
from: { opacity: 0, marginTop: -5000 },
delay: "2000"
});
const counter = useSpring({
number: 1,
from: { number: 0 },
delay: "2700"
});
return (
<animated.div style={fadeFromtop}>
<div style={c2style}>
<div style={title}>Hi im fade in from margin top</div>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quaerat nu
mquam, nulla nostrum, offic
</p>
<animated.div >{counter.number}</animated.div>
</div>
</animated.div>
);
}
const c2style = {
background: "#F9CE21",
height: "300px",
display: 'flex',
justifyContent:'center',
alignItems:'center',
flexDirection:'column'
};
const title ={
fontWeight:'bold',
fontSize:'50px'
}
export default FadeFromTopAndcounter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment