Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta http-equiv="X-UA-Compatible" content="ie=edge" />
- <title>Animation</title>
- <link rel="stylesheet" href="style_bigdonation.css" />
- </head>
- <audio autoplay>
- <source src="schannik_busy.mp3" type="audio/mpeg">
- </audio>
- <body>
- <div class="tempBackground"></div>
- <div class="Alert">
- <div class="Text">NICE</div>
- <div class="Text">HOST</div>
- <div class="Text">NICE</div>
- <div class="Text">HOSTT</div>
- <div class="Text">DANKE!</div>
- <div class="Name">{name}</div>
- <div class="Number">{amount}</div>
- </div>
- </body>
- </html>
- -------------------------------------------------------------------------------------------------------
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- @font-face {
- font-family: 'pricedown';
- src: url('pricedown.ttf');
- }
- html,
- body {
- width: 100%;
- height: 100%;
- }
- .tempBackground {
- position: fixed;
- width: 100%;
- height: 100%;
- background-image: url('bg.png');
- background-repeat: no-repeat;
- background-size: cover;
- }
- .Alert {
- position: relative;
- z-index: 10;
- width: 100%;
- height: 400px;
- color: #ffffff;
- font-family: 'pricedown';
- }
- .Name,
- .Number,
- .Text {
- position: absolute;
- text-shadow: 0 5px 10px rgba(0, 0, 0, 0.7);
- }
- .Text:nth-child(1) {
- opacity: 0;
- max-width: 174.83px;
- min-width: 174.83px;
- width: 174.83px;
- max-height: 172.52px;
- min-height: 172.52px;
- height: 172.52px;
- left: 10%;
- top: 30%;
- font-size: 100px;
- transform: rotate(-35deg);
- animation: dropIn1 200ms ease forwards, fadeOut 5000ms ease forwards;
- animation-delay: 1090ms;
- }
- .Text:nth-child(2) {
- opacity: 0;
- left: 20%;
- top: 34%;
- font-size: 90px;
- transform: rotate(35deg);
- animation: dropIn2 200ms ease forwards, fadeOut 5000ms ease forwards;
- animation-delay: 1250ms;
- }
- .Text:nth-child(3) {
- opacity: 0;
- right: 30%;
- top: 10%;
- font-size: 100px;
- transform: rotate(10deg);
- animation: dropIn3 200ms ease forwards, fadeOut 5000ms ease forwards;
- animation-delay: 2080ms;
- }
- .Text:nth-child(4) {
- opacity: 0;
- right: 7%;
- top: 34%;
- font-size: 90px;
- transform: rotate(46deg);
- animation: dropIn4 200ms ease forwards, fadeOut 5000ms ease forwards;
- animation-delay: 2190ms;
- }
- .Text:nth-child(5) {
- opacity: 0;
- right: 25%;
- top: 48%;
- font-size: 90px;
- transform: rotate(-15deg);
- animation: dropIn5 200ms ease forwards, fadeOut 5000ms ease forwards;
- animation-delay: 3020ms;
- }
- .Name {
- font-size: 70px;
- transform: scale(0) translateX(-50%);
- left: 50%;
- top: 20%;
- z-index: 10;
- transform-origin: 0 50%;
- animation: dropIn6 200ms ease forwards;
- animation-delay: 3110ms;
- }
- .Number {
- font-size: 150px;
- transform: scale(0) translateX(-50%);
- left: 50%;
- top: 30%;
- transform-origin: 0 50%;
- animation: slide-in-bck-center 7000ms ease forwards;
- animation-delay: 3270ms;
- }
- .slide-in-bck-center {
- -webkit-animation: slide-in-bck-center 2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
- animation: slide-in-bck-center 2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
- }
- @-webkit-keyframes slide-in-bck-center {
- 0% {
- -webkit-transform: translateZ(600px) translateX(-50%);
- transform: translateZ(600px) translateX(-50%);
- opacity: 0;
- }
- 100% {
- -webkit-transform: translateZ(0) translateX(-50%);
- transform: translateZ(0) translateX(-50%);
- opacity: 1;
- }
- }
- @keyframes slide-in-bck-center {
- 0% {
- -webkit-transform: translateZ(600px) translateX(-50%);
- transform: translateZ(600px) translateX(-50%);
- opacity: 0;
- }
- 100% {
- -webkit-transform: translateZ(0) translateX(-50%);
- transform: translateZ(0) translateX(-50%);
- opacity: 1;
- }
- }
- @keyframes scale-in-center {
- 0% {
- -webkit-transform: scale(0) translateX(-50%);
- transform: scale(0) translateX(-50%);
- opacity: 1;
- }
- 100% {
- -webkit-transform: scale(1) translateX(-50%);
- transform: scale(1) translateX(-50%);
- opacity: 1;
- }
- }
- @keyframes fadeOut {
- 0% { opacity: 1;}
- 99% { opacity: 0.01;width: 100%; height: 100%;}
- 100% { opacity: 0;width: 0; height: 0;}
- }
- @keyframes dropIn1 {
- 0% {
- opacity: 0;
- transform: scale(5) rotate(-35deg);
- }
- 100% {
- opacity: 1;
- transform: scale(1) rotate(-35deg);
- }
- }
- @keyframes dropIn2 {
- 0% {
- opacity: 0;
- transform: scale(5) rotate(35deg);
- }
- 100% {
- opacity: 1;
- transform: scale(1) rotate(35deg);
- }
- }
- @keyframes dropIn3 {
- 0% {
- opacity: 0;
- transform: scale(9) rotate(10deg);
- }
- 100% {
- opacity: 1;
- transform: scale(1) rotate(10deg);
- }
- }
- @keyframes dropIn4 {
- 0% {
- opacity: 0;
- transform: scale(5) rotate(46deg);
- }
- 100% {
- opacity: 1;
- transform: scale(1) rotate(46deg);
- }
- }
- @keyframes dropIn5 {
- 0% {
- opacity: 0;
- transform: scale(5) rotate(-15deg);
- }
- 100% {
- opacity: 1;
- transform: scale(1) rotate(-15deg);
- }
- }
- @keyframes dropIn6 {
- 0% {
- opacity: 0;
- transform: scale(5) translateX(-50%);
- }
- 100% {
- opacity: 1;
- transform: scale(1) translateX(-50%);
- }
- }
- @keyframes scaleUp {
- 0% {
- opacity: 0;
- transform: scale(0) translateX(-50%);
- }
- 100% {
- opacity: 1;
- transform: scale(1) translateX(-50%);
- }
- }
- -----------------------------------------------------------------------------------------------------------
- (function () {
- var animateImg = {animateImg}, // true false
- hideImg = false,
- barsAnimation = "{barsAnimation}", // fromLeft fromTop fromRight fromBot
- textAnimation = "{textAnimation}", // fromLeft fromTop fromRight fromBot none
- textStaggerTop = "{textStagger}", // 0 "center" "end"
- terxtStaggerBottom = "{textStagger}", // 0 "center" "end"
- msgDirection = "{msgDirection}", // fromLeft fromTop fromRight fromBot none
- delayTime = {delayTime} * 1000;
- var barsX, barsY, textX, textY, msgX, msgY, msgXOut, msgYOut;
- if(hideImg){
- $("#imageHolder").hide();
- }
- $("#alertImg").on('error', function(){
- $("#alertImg").remove();
- });
- if(barsAnimation == "fromLeft"){
- barInX = "-101%";
- barInY = "0%";
- barOutX = "+101%";
- barOutY = "0%"
- } else if(barsAnimation == "fromTop") {
- barInX = "0%";
- barInY = "-101%";
- barOutX = "0%";
- barOutY = "+101%"
- } else if(barsAnimation == "fromRight") {
- barInX = "101%";
- barInY = "0%";
- barOutX = "-101%";
- barOutY = "0%"
- } else if(barsAnimation == "fromBot") {
- barInX = "0%";
- barInY = "101%";
- barOutX = "0%";
- barOutY = "-101%"
- }
- if(textAnimation == "fromLeft"){
- textX = "-30%";
- textY = "0%";
- } else if(textAnimation == "fromTop") {
- textX = "0%";
- textY = "-30%";
- } else if(textAnimation == "fromRight") {
- textX = "30%";
- textY = "0%";
- } else if(textAnimation == "fromBot") {
- textX = "0%";
- textY = "30%";
- } else if(textAnimation == "none") {
- textX = "0%";
- textY = "0%";
- }
- if(msgDirection == "fromLeft"){
- msgX = "-=20px";
- msgY = "0%";
- } else if(msgDirection == "fromTop") {
- msgX = "0%";
- msgY = "-50%";
- } else if(msgDirection == "fromRight") {
- msgX = "+=20px";
- msgY = "0%";
- } else if(msgDirection == "fromBot") {
- msgX = "0%";
- msgY = "50%";
- } else if(msgDirection == "none") {
- msgX = "0%";
- msgY = "0%";
- }
- function loadScript (url) {
- return new Promise(function (resolve, reject) {
- const script = document.createElement('script')
- script.onload = resolve
- script.onerror = reject
- script.src = url
- document.head.appendChild(script)
- })
- }
- loadScript('https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.3/TweenMax.min.js').then(function () {
- loadScript('https://s3.amazonaws.com/cdn.nerdordie.com/gsap/SplitText-2-1-2.min.js').then(function () {
- animate();
- });
- });
- var animate = function() {
- var tl = new TimelineMax(),
- imgTl = new TimelineMax({paused: true}),
- topTl = new TimelineMax({paused: true}),
- botTl = new TimelineMax({paused: true, onComplete: reverseIt}),
- msgTl = new TimelineMax({paused: true}),
- topSplit = new SplitText("#topText", {type:"chars"}),
- botSplit = new SplitText("#botText", {type:"chars"}),
- msgSplit = new SplitText("#alert-user-message", {type:"lines"}),
- topChars = topSplit.chars,
- botChars = botSplit.chars,
- msgLines = msgSplit.lines
- ;
- tl.timeScale(1);
- topTl.timeScale(1);
- botTl.timeScale(1);
- tl
- .to("#alertHolder", .1, {delay: .1, opacity: 1, onComplete: playImg})
- if(animateImg){
- imgTl
- .from("#imgBg", 0.4, {x: barInX, y: barInY, ease: Power4.easeInOut, onStart: playTop})
- .from("#alertImg", 0, {opacity: 0})
- .to("#imgBg", 0.4, {x: barOutX, y: barOutY, ease: Power4.easeInOut})
- } else {
- TweenMax.set("#imgBg", {opacity: 0})
- imgTl
- .from("#alertImg", 1, {opacity: 0, onStart: playTop})
- }
- topTl
- .from("#topBgAbove", 0.8, {x: barInX, y: barInY, delay: 0.4, ease: Power4.easeInOut, onStart: playBot})
- .from("#topBg", 0, {opacity: 0})
- .to("#topBgAbove", .8, {x: barOutX, y: barOutY, delay: 0.4, ease: Power4.easeInOut, delay: .2})
- .staggerFrom(topChars, 0.4, {opacity:0, x: textX, y: textY, ease: Power1.easeOut, stagger: {
- from: textStaggerTop,
- amount: .4,
- ease: Power4.EaseOut
- }}, null, "-=.4")
- botTl
- .from("#botBgAbove", .8, {x: barInX, y: barInY, delay: 0.4, ease: Power4.easeInOut})
- .from("#botBg", 0, {opacity: 0})
- .to("#botBgAbove", .8, {x: barOutX, y: barOutY, delay: 0.4, ease: Power4.easeInOut, delay: .2})
- .staggerFrom(botChars, 0.4, {opacity:0, x: textX, y: textY, ease: Power1.easeOut, stagger: {
- from: terxtStaggerBottom,
- amount: .4,
- ease: Power4.EaseOut
- }}, null, "-=.4")
- msgTl
- .staggerFrom(msgLines, 1.4, {opacity:0, x: msgX, y: msgY, ease: Power2.easeOut}, 0.1)
- .set(msgLines, {onStart: pauseMsg})
- .staggerTo(msgLines, 1, {delay: .2, opacity:0, x: msgX, y: msgY, ease: Power2.easeIn}, -0.2)
- ;
- function playImg(){
- imgTl.play();
- }
- function playTop(){
- topTl.play();
- }
- function playBot(){
- botTl.play();
- setTimeout(function(){
- msgTl.play();
- }, 800);
- }
- function reverseIt(){
- setTimeout(function(){
- imgTl.reverse().timeScale(0.4);
- topTl.reverse().timeScale(1.2);
- botTl.reverse().timeScale(1.2);
- msgTl.play();
- }, delayTime);
- }
- function pauseMsg(){
- msgTl.pause();
- }
- } // end of animate function
- }()); // end of function wrapper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement