/* Animation property */ .screen { animation: scroll 5s infinite cubic-bezier(.52,-0.39,.3,1.43); } .screen:hover { animation-play-state: paused; } .screen:hover .message { opacity: 1; transform: none; } /* Keyframes */ @keyframes scroll { 0%, 10% { background-position: 0 0; } 20%, 30% { background-position: 0 -22em; } 50%, 60% { background-position: 0 -44em; } 90%, 100% { background-position: 0 0; } } /* Generat styling */ body { background: #36a1d9; } .screen { border-radius: 1em; background: #e25865 url(https://cssanimation.rocks/screen/images/screen_bg.png) no-repeat top center; background-size: 98% auto; border: 2em solid #fff; width: 40em; height: 30em; position: absolute; top: calc(50% - 17em); left: calc(50% - 22em); overflow: hidden; } .message { position: absolute; text-align: center; top: 4em; right: 4em; bottom: 4em; left: 4em; line-height: 6.75em; background: rgba(0,0,0,0.5); border-radius: 0.5em; color: #fff; font-family: Helvetica, Arial, sans-serif; font-size: 2em; opacity: 0; transition: all 0.4s ease-out; transform: translateY(0.5em); }