纯css实现svg地球仪旋转效果
代码语言:html
所属分类:三维
代码描述:通过css设置实现一个简单的蓝色地球仪的效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> /** Globe Elements **/ .globe__placeholder { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; overflow: visible; position: relative; float: left; padding: 1.7em; margin: 0; margin-bottom: 16px; height: 200px; /* Unscaled is 200px. If 'globe__container' is scaled, multiply this value by scale() property, e.g. 200px * 0.5 = 100px */ width: 200px; /* Unscaled is 200px. If 'globe__container' is scaled, multiply this value by scale() property, e.g. 200px * 0.5 = 100px */ } .globe__container { overflow: visible; position: relative; display: block; margin: 0; padding: 0; top: 0; left: 0; } .globe__container, .globe { width: 200px; height: 200px; } .globe { overflow: visible; position: relative; display: block; margin: 0; padding: 0; top: 0; left: 0; } .globe__worldmap, .globe__worldmap__front, .globe__worldmap__back, .globe__sphere, .globe__outer_shadow, .globe__reflections__bottom, .globe__inner_shadow, .globe__reflections__top, .globe__outer_shadow { position: absolute; display: block; margin: 0; right: auto; bottom: auto; } .globe__sphere, .globe__outer_shadow, .globe__reflections__bottom, .globe__inner_shadow, .globe__reflections__top { left: 0; top: 0; width: 200px; height: 200px; background-position: 0 0; background-repeat: no-repeat; } .globe__outer_shadow { left: 0; top: 186px; width: 200px; height: 30px; background-position: 0 0; background-repeat: no-repeat; } /* Circle mask for animated SVG files */ .globe__worldmap { left: 0; top: 0; width: 200px; height: 200px; overflow: hidden; -webkit-border-radius: 50%; -khtml-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%); /* overflow: visible; */ } .globe__worldmap__front, .globe__worldmap__back { left: 0; top: 0; width: 1000px; height: 200px; overflow: visible; background-image: url(http://repo.bfw.wiki/bfwrepo/svg/worldmap_2x.svg); background-repeat: no-repeat; } /** Globe elements visibility options **/ .globe__sphere { background-image: url(http://www.cakecounter.com/globe/white-blue/globe_images/sphere.svg); display: none;} .globe__outer_shadow { background-image: url(http://www.cakecounter.com/globe/white-blue/globe_images/outer_shadow.svg);} .globe__reflections__top { background-image: url(http://www.cakecounter.com/globe/white-blue/globe_images/reflections.svg); display: none;} .globe__reflections__bottom { background-image: url(http://www.cakecounter.com/globe/white-blue/globe_images/reflections.svg); display: none;} .globe__inner_shadow { background-image: url(http://www.cakecounter.com/globe/white-blue/globe_images/inner_shadow.svg);} .globe__worldmap__front { background-position: 0px 0px; animation: textureSpinreverse 8s linear infinite; } .globe__worldmap__back { background-position: 0px -220px; animation: textureSpin 8s linear infinite; } body { background-color: #fff; font-family: Georgia, serif; line-height: 1.5; font-size: 18px; color: #2c3e50; } .container h2 { padding: 0; margin: 0; padding-top: 1.65em; padding-bottom: 0.5em; font-size: 32px; line-height: 1.2; } .container h2 span { font-size: 65%; } .container h3 { padding: 0; margin: 0; font-size: 18px; font-weight: normal; padding-bottom: 1em; } .container p { color: #a6aeb5; } .container { margin: 0 auto; width: 100%; padding-left: 300px; padding-right: 10%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; /*outline: 1px solid green;*/ } .container .btn { text-align: right; clear: both; padding: 1em; padding-top: 1.5em; border-top: 1px solid rgba(0,0,0,0.1); } .container button { width: 100px; height: 40px; border: none; border-bottom: 1px solid #ccc; background-color: #efefef; border-radius: 4px; } .controls { background-color: #F8F8F8; font: normal 14px/1 Arial, Tahoma; width: 266px; position: absolute; top: 0; left: 0; /* */ z-index: 100; height: 100%; overflow: auto; -webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0, 0.1); -moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0, 0.1); box-shadow: 2px 2px 5px 0px rgba(0,0,0, 0.1); } .controls div { padding: 10px 20px; clear: both; } .controls div#stage-bg-color { padding-top: 20px; padding-bottom: 6px; } a { color: #ccc; text-decoration: none; } a:hover { color: #000; text-decoration: none; } a.on { color: #51B7FF; text-decoration: none; pointer-events: none; /* IE 11+, Safari 4+, Firefox 3.6+, Chrome */ } div.opacity { padding-bottom: 0; } div.opacity div { padding-left: 15px; margin-right: 10px; position: relative; font-size: 12px; } input.range { width: 80px; float: right; padding: 0; margin: 0; } input.text { width: 35px; border: none; background-color: #fff; color: #ccc; display: none; } input.color { font-siz.........完整代码请登录后点击上方下载按钮下载查看
网友评论0