使用CSS3 Transforms变换和Animations动画练习制作钢铁侠胸口的小型核反应堆,个人觉得光看还是不行的,还是要多练,并对其中用到得不太熟悉的css属性进行温习补缺。

先制作一个黑暗的背景容器body {

margin: 0;

}

.fullpage-wrapper {

height: 100vh;

background: radial-gradient(#353c44, #222931);

}

vh是指CSS中相对长度单位,表示相对视口高度(Viewport Height),1vh = 1% * 视口高度。浏览器支持:IE9+;

radial-gradient() 函数用径向渐变创建 "图像"。径向渐变由中心点定义,为了创建径向渐变你必须设置两个终止色。浏览器支持:IE10+。background: radial-gradient(shape size at position, start-color, ..., last-color);值描述

shape确定圆的类型:

● ellipse (默认): 指定椭圆形的径向渐变。

● circle :指定圆形的径向渐变

size定义渐变的大小,可能值:

● farthest-corner (默认) : 指定径向渐变的半径长度为从圆心到离圆心最远的角

● closest-side :指定径向渐变的半径长度为从圆心到离圆心最近的边

● closest-corner : 指定径向渐变的半径长度为从圆心到离圆心最近的角

● farthest-side :指定径向渐变的半径长度为从圆心到离圆心最远的边

position定义渐变的位置。可能值:

● center(默认):设置中间为径向渐变圆心的纵坐标值。

● top:设置顶部为径向渐变圆心的纵坐标值。

● bottom:设置底部为径向渐变圆心的纵坐标值。

start-color, ..., last-color用于指定渐变的起止颜色。

核反应堆垂直水平居中.fullpage-wrapper {

height: 100vh;

background: radial-gradient(#353c44, #222931);

/*声明flex容器*/

display:flex;

}

.reactor-container {

width: 300px;

height: 300px;

/*margin:auto;垂直水平居中*/

margin: auto;

border: 1px dashed #888;

}

关于Flexbox弹性布局请看这里,关于Flexbox弹性布局之实例片段点这里。浏览器兼容:IE10+。

CSS中的同心圆

position: absolute;

width: 70px;

height: 70px;

top: 0;

right: 0;

bottom: 0;

left: 0;

margin: auto;

border-radius: 50%;

border: 5px solid #1b4e5f;

background-color: #fff;

}

最终代码

因为需要多个圆,所以这的css样式进行拆分。篇幅有限,直接贴出最终的结构代码与样式。

HTML结构:

CSS样式:body {

margin: 0;

}

.fullpage-wrapper {

height: 100vh;

background: radial-gradient(#353c44, #222931);

display:flex;

}

.reactor-container {

width: 300px;

height: 300px;

margin: auto;

border: 1px dashed #888;

}

.circle {

border-radius: 50%;

}

.abs-center {

position: absolute;

top: 0;

right: 0;

bottom: 0;

left: 0;

margin: auto;

}

.core-inner {

width: 70px;

height: 70px;

border: 5px solid #1b4e5f;

background-color: #fff;

box-shadow: 0px 0px 7px 5px #52fefe, 0px 0px 10px 10px #52fefe inset;

}

.core-outer {

width: 120px;

height: 120px;

border: 1px solid #52fefe;

background-color: #fff;

box-shadow: 0px 0px 2px 1px #52fefe, 0px 0px 10px 5px #52fefe inset;

}

.core-wrapper {

width: 180px;

height: 180px;

background-color: #073c4b;

box-shadow: 0px 0px 5px 4px #52fefe, 0px 0px 6px 2px #52fefe inset;

}

.tunnel {

width: 220px;

height: 220px;

background-color: #fff;

box-shadow: 0px 0px 5px 1px #52fefe, 0px 0px 5px 4px #52fefe inset;

}

.coil-container {

position: relative;

width: 100%;

height: 100%;

animation-name: reactor-anim;

animation-duration: 3s;

animation-iteration-count: infinite;

animation-timing-function: linear;

}

.coil {

position: absolute;

width: 30px;

height: 20px;

top: calc(50% - 110px);

left: calc(50% - 15px);

transform-origin: 15px 110px;

background-color: #073c4b;

box-shadow: 0px 0px 5px #52fefe inset;

}

.coil-1 {

transform: rotate(0deg);

}

.coil-2 {

transform: rotate(45deg);

}

.coil-3 {

transform: rotate(90deg);

}

.coil-4 {

transform: rotate(135deg);

}

.coil-5 {

transform: rotate(180deg);

}

.coil-6 {

transform: rotate(225deg);

}

.coil-7 {

transform: rotate(270deg);

}

.coil-8 {

transform: rotate(315deg);

}

@keyframes reactor-anim {

from {

transform: rotate(0deg);

}

to {

transform: rotate(360deg);

}

}

.reactor-container {

width: 300px;

height: 300px;

margin: auto;

border: 1px dashed #888;

position: relative;

border-radius: 50%;

background-color: #384c50;

border: 1px solid rgb(18, 20, 20);

box-shadow: 0px 0px 32px 8px rgb(18, 20, 20), 0px 0px 4px 1px rgb(18, 20, 20) inset;

}

box-shadow的用法:/* x偏移量 | y偏移量 | 阴影颜色 */

box-shadow: 60px -16px teal;

/* x偏移量 | y偏移量 | 阴影模糊半径 | 阴影颜色 */

box-shadow: 10px 5px 5px black;

/* x偏移量 | y偏移量 | 阴影模糊半径 | 阴影扩散半径 | 阴影颜色 */

box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);

/* 插页(阴影向内) | x偏移量 | y偏移量 | 阴影颜色 */

box-shadow: inset 5em 1em gold;

/* 任意数量的阴影,以逗号分隔 */

box-shadow: 3px 3px red, -1em 0 0.4em olive;

/* 全局关键字 */

box-shadow: inherit;

box-shadow: initial;

box-shadow: unset;

浏览器兼容:IE9+;

calc()函数的用法:

calc()函数可以用在任何一个需要、, 、、、或的地方。有了calc(),你就可以通过计算来决定一个CSS属性的值了。

你还可以在一个 calc() 内部嵌套另一个 calc() ,里面的 calc() 会被简单地视为加了括号。

浏览器兼容:IE9+;/* property: calc(expression) */

width: calc(100% - 80px);

transform-origin

transform-origin CSS属性让你更改一个元素变形的原点。/* One-value syntax */

transform-origin: 2px;

transform-origin: bottom;

/* x-offset | y-offset */

transform-origin: 3cm 2px;

/* x-offset-keyword | y-offset */

transform-origin: left 2px;

/* x-offset-keyword | y-offset-keyword */

transform-origin: right top;

/* y-offset-keyword | x-offset-keyword */

transform-origin: top right;

/* x-offset | y-offset | z-offset */

transform-origin: 2px 30% 10px;

/* x-offset-keyword | y-offset | z-offset */

transform-origin: left 5px -3px;

/* x-offset-keyword | y-offset-keyword | z-offset */

transform-origin: right bottom 2cm;

/* y-offset-keyword | x-offset-keyword | z-offset */

transform-origin: bottom right 2cm;

/* Global values */

transform-origin: inherit;

transform-origin: initial;

transform-origin: unset;

transform-origin属性可以使用一个,两个或三个值来指定,其中每个值都表示一个偏移量。 没有明确定义的偏移将重置为其对应的初始值。

css钢铁侠视角,css练习制作钢铁侠胸口的小型核反应堆相关推荐

  1. css钢铁侠视角,CSS3 Iron Man 钢铁侠肖像

    CSS 语言: CSSSCSS 确定 * { margin: auto; padding: 0; -webkit-box-sizing: border-box; } body { background ...

  2. No.3 - CSS transition 和 CSS transform 配合制作动画

    课程概述 作业提交截止时间:09-01 任务目的 深度理解掌握 transition-timing-function 以及它的意义 学会配合使用 CSS transform 和CSS transiti ...

  3. 网页制作 css样式,网页设计与制作-CSS样式.ppt

    网页设计与制作-CSS样式 第四章CSS样式 4.1 CSS样式的定义和使用 4.1.1什么是CSS CSS(Cascading Style Sheet,层叠样式表)是一种格式化网页的标准方式,它扩展 ...

  4. 背景的css代码,CSS网页设计实例:设计制作大背景网页_css

    网页制作Webjx文章简介:如何用css实现大背景网页设计. 自从我发布了大背景网页设计合集之后,我收到了很多电子邮件询问如何用css实现大背景的网页设计.因此我决定和大家分享大背景网站的设计技巧.在 ...

  5. css动画在线生成,在线制作css动画——cssanimate

    熟悉CSS的人都知道,CSS可以实现很多漂亮的动画,特别是它的在线功能,能够帮助人们解决很多制作动画的效果.今天特别推荐一个在线CSS插件功能--cssanimate,这个最大的特色就是以图形界面方式 ...

  6. CSS+html:天涯网页仿照制作

     CSS+html:天涯网页仿照制作 <!DOCTYPE html> <html> <head lang="en"><meta cha ...

  7. 【CSS】课程网站 Banner 制作 ② ( Banner 栏版心盒子测量 | Banner 版心盒子模型左侧导航栏代码示例 )

    文章目录 一.Banner 栏版心盒子测量 1.测量版心元素尺寸 2.课程表测量 二.Banner 版心盒子模型左侧导航栏代码示例 1.HTML 标签结构 2.CSS 样式 3.展示效果 一.Bann ...

  8. HTML+CSS静态页面网页设计作业——2019凡客服装店铺商城(1页) HTML+CSS+JavaScript HTML+CSS大作业_ 服装店铺网页制作作业_购物网页设计...

    HTML5期末大作业:服装店铺商城网站设计--2019凡客服装店铺商城(1页) HTML+CSS+JavaScript HTML+CSS大作业: 服装店铺网页制作作业_购物网页设计- 文章目录 HTM ...

  9. 基于Html+Css+javascript的游戏网页制作红色主题(我和我的祖国10页)

    ⛵ 源码获取 文末联系 ✈ Web前端开发技术 描述 网页设计题材,DIV+CSS 布局制作,HTML+CSS网页设计期末课程大作业 | 茶文化网站 | 中华传统文化题材 | 京剧文化水墨风书画 | ...

  10. css sprit雪碧图制作,使用教程

    写在前面: 在网页制作中,雪碧图也是前端攻城狮必须掌握的一项小技能.百度词条对雪碧图的解释是:CSS雪碧 即CSS Sprite,也有人叫它CSS精灵,是一种CSS图像合并技术,该方法是将小图标和背景 ...

最新文章

  1. ebp 函数堆栈esp_对于ESP、EBP寄存器的理解
  2. PgSQL · 最佳实践 · CPU满问题处理
  3. Rational Rose 下载安装
  4. 《ArcGis地图数据资料》(DataMap)ArcGis 9.0
  5. 利用expect实现自动化操作
  6. pytorch使用torch.nn.Sequential构建网络
  7. Android API中文文档(111) —— MailTo
  8. 当心路径层次太深,名字太长造成解压失败
  9. MS SQL 2008数据库完全卸载指南
  10. 数字通信之抽样(二)
  11. 网站服务器域名费用入什么科目,企业域名服务费记什么科目
  12. 【LeetCode】 374. 猜数字大小 骚气的猴子算法 打死都找不着系列 JAVA
  13. 计算机科学第三讲——布尔逻辑和逻辑门
  14. php现在编辑pdf,用PHP编辑PDF?
  15. Windows电脑上最好的3个epub阅读器
  16. mysql查询每个部门工资最高的员工信息_获取每个部门中当前员工薪水最高的相关信息...
  17. 人工智能之语音机器人
  18. android studio 配置+安装
  19. java 大学简明教程_Simply-Java 《JAVA大学简明教程:实例程序设计》例子及习题源代码 - 下载 - 搜珍网...
  20. css filter改变图片的颜色,神奇的操作~

热门文章

  1. jupyter无法重命名,文件不可信,后台被自动关闭
  2. ios 根据日期知道周几_iOS 计算指定日期是周几星期几
  3. 电脑网络问题,IP释放,重新获取IP
  4. 戴尔微型计算机7050配置,小巧彪悍 戴尔 OptiPlex 7050 微型机评测
  5. linux下cat导出日志,Linux命令:cat
  6. 耗子大叔分享的软件设计原则
  7. py交易----实验吧
  8. Thematic Contests CodeForces - 1077E
  9. 初学者计算机电脑怎样学,初学者怎样学习电脑能够快速入门(免费科普电脑基础知识)...
  10. 单片机c语言课后题答案,单片机原理及应用(C语言版)习题答案.doc