Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
@import url('https://fonts.googleapis.com/css?family=Playfair+Display:400italic'); @import url('https://fonts.googleapis.com/css?family=Montserrat:400,700'); body { background: #2c283f; font-family: Montserrat, sans-serif; color: #fff; } .play-button { position: absolute; top: 50%; left: 50%; width: 6.25rem; height: 5rem; margin-top: 0rem; margin-left: -3.125rem; font-size: 1rem; cursor: pointer; } .play-button > .circle { position: relative; width: 2.125em; height: 2.125em; margin: auto; } .play-button > .circle > .icon { position: absolute; z-index: 5; position: absolute; top: 50%; left: 50%; width: 0.75em; height: 0.875em; margin-top: -0.4375em; margin-left: -0.375em; display: none; margin-left: -0.29em; } .play-button > .circle > .black { z-index: 4; position: absolute; top: 50%; left: 50%; width: 62px; height: 62px; margin-top: -31px; margin-left: -31px; opacity: 0.9; } .play-button > .circle > .yellow { position: absolute; z-index: 3; position: absolute; top: 50%; left: 50%; width: 48px; height: 48px; margin-top: -24px; margin-left: -24px; } .play-button > .circle > .border { position: absolute; z-index: 2; position: absolute; top: 50%; left: 50%; width: 72px; height: 72px; margin-top: -36px; margin-left: -36px; } .play-button > .circle > .white { position: absolute; z-index: 2; position: absolute; top: 50%; left: 50%; width: 120px; height: 120px; margin-top: -60px; margin-left: -60px; opacity: 0.1; } .play-button > .circle > .lines { position: absolute; display: none; } .play-button > .text { position: relative; margin-top: 2.375em; font-size: 0.75em; color: #fff; text-transform: uppercase; text-align: center; }
var self = this; var $playBtn = $('.play-button'); TweenMax.set($playBtn.find('circle'), { transformOrigin: "center center" }); self.pulseTl = new TimelineMax({ yoyo: true, repeat: -1 }); self.pulseTl.fromTo($playBtn.find('.white'), 2, { scale: 1 }, { scale: 1.2, ease: Power2.easeInOut }); self.spinTl = new TimelineMax({ repeat: -1 }); self.spinTl.to($playBtn.find('.border'), 5, { rotation: 360, ease: Linear.easeNone }); var onReverse = function() { var self = this; self.pulseTl.resume(); self.spinTl.pause(); }; self.hoverTl = new TimelineMax({ paused: true, onReverseComplete: onReverse, onReverseCompleteScope: self }); self.hoverTl.to($playBtn.find('.black circle'), .25, { scale: 0, ease: Circ.easeIn }, "start") .to($playBtn.find('.yellow circle'), .45, { scale: 0, ease: Circ.easeIn }, "start") .set($playBtn.find('.black circle'), { fill: '#171521' }) .set($playBtn.find('.icon'), { display: 'block' }) .to($playBtn.find('.black circle'), .20, { scale: 3.4, ease: Circ.easeOut }, "end") .from($playBtn.find('.border circle'), .35, { scale: 0, ease: Circ.easeOut }, "end") .to($playBtn.find('.white circle'), .45, { scale: 1.4, ease: Back.easeOut }, "end") .to($playBtn.find('.text'), .55, { y: 15, ease: Back.easeOut }, "end"); self.hoverTl.timeScale(1.1); $playBtn.on('click', function() { $el = $(this); }) .on('mouseenter', function() { $el = $(this); self.pulseTl.pause(); self.hoverTl.play(); self.spinTl.play(); }) .on('mouseleave', function() { $el = $(this); self.hoverTl.reverse(); });