div+css实现宇宙行星彗星动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现宇宙行星彗星动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { background: #181743; overflow: hidden; } .planet-container { width: 200px; height: 200px; padding: 20px; -moz-border-radius: 200px; -webkit-border-radius: 200px; border-radius: 200px; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMTU4NDk0IiB5MT0iLTAuMDkxNTA2IiB4Mj0iMC44NDE1MDYiIHkyPSIxLjA5MTUwNiI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y5MDI2ZCIvPjxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjMDAwMDAwIiBzdG9wLW9wYWNpdHk9IjAuMCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIgc3RvcC1vcGFjaXR5PSIwLjAiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA='); background: -moz-linear-gradient(300deg, #f9026d, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)); background: -webkit-linear-gradient(300deg, #f9026d, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)); background: linear-gradient(150deg, #f9026d, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)); position: absolute; -moz-animation: planet-moving 2s ease infinite; -webkit-animation: planet-moving 2s ease infinite; animation: planet-moving 2s ease infinite; -moz-transition: all 0.2s ease; -o-transition: all 0.2s ease; -webkit-transition: all 0.2s ease; transition: all 0.2s ease; left: 42%; } .planet-container .shine { width: 0; height: 0; position: absolute; border-left: 35px solid transparent; border-right: 35px solid transparent; border-top: 28px solid #eb6db4; -moz-border-radius: 50%; -webkit-border-radius: 50%; border-radius: 50%; -moz-transform: rotate(-40deg); -ms-transform: rotate(-40deg); -webkit-transform: rotate(-40deg); transform: rotate(-40deg); top: 45px; left: 38px; } .planet-container .shine::after { content: ""; position: absolute; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNjAwNTgyIiB5MT0iLTAuMDcwNDI4IiB4Mj0iMC4zOTk0MTgiIHkyPSIxLjA3MDQyOCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2M5MDc3OSIvPjxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjNzcwZThkIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjMzUxNDVhIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); background: -moz-linear-gradient(260deg, #c90779, #770e8d, #35145a); background: -webkit-linear-gradient(260deg, #c90779, #770e8d, #35145a); background: linear-gradient(190deg, #c90779, #770e8d, #35145a); height: 160px; width: 160px; -moz-border-radius: 100px; -webkit-border-radius: 100px; border-radius: 100px; left: -78px; top: -16px; } .planet-container .shine-2, .planet-container .shine-2::after { position: absolute; width: 13px; height: 11px; background: #eb6db4; -moz-border-radius: 100px; -webkit-border-radius: 100px; border-radius: 100px; top: 65px; left: 45.5px; -moz-transform: rotate(-55deg); -ms-transform: rotate(-55deg); -webkit-transform: rotate(-55deg); transform: rotate(-55deg); } .planet-container .shine-2::after { content: ""; top: 9px; left: 43.5px; transform: rotate(206deg); width: 12px; height: 10px; } .planet-container .shine-2::before { content: ""; position: absolute; height: 10px; width: 14px; background: #eb6db4; -moz-border-radius: 200px; -webkit-border-radius: 200px; border-radius: 200px; top: 24px; left: 60px; -moz-transform: rotate(40deg); -ms-transform: rotate(40deg); -webkit-transform: rotate(40deg); transform: rotate(40deg); } .planet-container .planet-ring, .planet-container .planet-ring2 { width: 300px; height: 40px; position: absolute; border-top: 10px solid transparent; border-bottom: 10px .........完整代码请登录后点击上方下载按钮下载查看
网友评论0