1.html代码

 <div class="clock">
<div class="line line1">
<div class="line-1"></div>
</div>
<div class="line line2">
<div class="line-1"></div>
</div>
<div class="line line3">
<div class="line-1"></div>
</div>
<div class="line line4">
<div class="line-1"></div>
</div>
<div class="line line5">
<div class="line-1"></div>
</div>
<div class="line line6">
<div class="line-1"></div>
</div> <div class="cover"></div>
<div class="hour"></div>
<div class="minute"></div>
<div class="second"></div>
<div class="center">
<div class="center1"></div>
</div>
</div>

2.css代码

     <style>
*{
margin:;
padding:;
}
/*钟表的外圈*/
.clock{
width: 300px;
height: 300px;
border: 10px solid #00ccbb;
border-radius: 50%;
margin: 100px auto;
position: relative;
}
.cover,.hour,.minute,.second,.center,.center1{
position: absolute;
left: 50%;
top: 50%;
}
.line,.line-1{
position: absolute;
left: 50%;
top:;
transform: translate(-50%,0%);
}
.cover,.center,.center1{
border-radius: 50%;
transform: translate(-50%,-50%);
}
.hour,.minute,.second{
transform: translate(-50%,-100%);
/*设置旋转中心*/
transform-origin: center bottom;
}
/*钟表的刻度基本样式*/
.line{
width: 8px;
height: 300px;
background-color: #ccc;
}
/*钟表刻度 1和4需要加粗*/
.line1,.line4{
width: 12px;
}
/*钟表样式的一一定位*/
.line2{
transform: translate(-50%,0%) rotate(30deg);
}
.line3{
transform: translate(-50%,0%) rotate(60deg);
}
.line4{
transform: translate(-50%,0%) rotate(90deg);
}
.line5{
transform: translate(-50%,0%) rotate(120deg);
}
.line6{
transform: translate(-50%,0%) rotate(150deg);
}
/*钟表刻度的装饰*/
.line-1{
width: 2px;
height: 300px;
background-color: #00ccbb;
}
/*覆盖物*/
.cover{
width: 270px;
height: 270px;
background-color: #fff;
}
/*时针*/
.hour{
width: 6px;
height: 80px;
background-color: red; /*添加动画*/
animation: clockAnimation 43200s linear infinite; }
/*分针*/
.minute{
width: 4px;
height: 100px;
background-color: #2000ff; /*添加动画*/
animation: clockAnimation 3600s linear infinite;
}
/*秒针*/
.second{
width: 2px;
height: 120px;
background-color: #22ff00; /*添加动画*/
animation: clockAnimation 60s steps(60) infinite;
}
/*中心点*/
.center{
width: 20px;
height: 20px;
background-color: #c1cbcc;
}
.center1{
width: 5px;
height: 5px;
background-color: #fff;
} /*创建动画*/
@keyframes clockAnimation {
from{
transform: translate(-50%,-100%) rotate(0deg);
}
to{
transform: translate(-50%,-100%) rotate(360deg);
}
}
</style>

3.效果图

h5-钟表动画案例的更多相关文章

  1. js实现一个简单钟表动画(javascript+html5 canvas)

    第一次在博客园注册发博.有一次去人家单位开标,看到开标网站上有个钟表动画,一时兴起,就写了个简单的钟表动画. 用js和html5 canvas对象实现一个简单钟表程序 主要用到的就是h5的canvas ...

  2. h5交互动画如何制作

    最近几年随着h5的兴起,复杂的h5动画,甚至是交互动画类型的产品不断涌现,尤其在课件产品方面,很多公司都有相关需求,最近很多h5开发工程师想了解相关方面的技术. 针对h5,如果是简单的动画效果,可以考 ...

  3. 写多个物件css3循环动画案例原理

    div { background-color: #67CF22; height: 100%; width: 6px; display: inline-block; -webkit-animation: ...

  4. H5 适配 动画animation js touch

    图片预加载jquery插件 jquery.imgpreload var load_img = [];load_img.push('http://m.pubuzhixing.com/Images/vot ...

  5. 用原生JS写移动动画案例及实际应用

    js很强大 相信很多人都知道,那么它有哪些强大之处呢?有兴趣的人可以去查查,这里就不赘述了,因为不在本片文章讨论的范围. 我们要讲的是怎么用原生JS写移动动画?我们先举一个最简单的动画例子,很多网站的 ...

  6. 20个专业H5(HTML5)动画工具推荐

    AnimateMate 可能是最好的 Sketch 动画插件.Sketch 目前被广泛应用于 HTML5 的原型界面设计,或者被应用于数据可视化的,动画部分则一般经由软件 Principle 等实现. ...

  7. react-motion 动画案例介绍

    第一个案例:Motion组件 import React,{Component} from 'react'; import {Motion,spring,presets} from 'react-mot ...

  8. iOS动画案例(1)

       受人所托,做一个类似于qq账号信息里的一个动画,感觉挺有意思,也没感觉有多难,就开始做了,结果才发现学的数学知识都还给体育老师了,研究了大半天才做出来.    先看一下动画效果:   用到的知识 ...

  9. iOS动画案例(2) 仿网易新闻标题动画

      由于产品的需要,做了一个和网易新闻标题类似的动画效果,现在新闻类的APP都是采用这样的动画效果,来显示更多的内容.先看一下动画效果:   由于这个动画效果在很多场合都有应用,所以我专门封装了一个控 ...

随机推荐

  1. Redis 详解 (四) redis的底层数据结构

    目录 1.演示数据类型的实现 2.简单动态字符串 3.链表 4.字典 5.跳跃表 6.整数集合 7.压缩列表 8.总结 上一篇博客我们介绍了 redis的五大数据类型详细用法,但是在 Redis 中, ...

  2. Springboot跨域 ajax jsonp请求

    SpringBoot配置: <dependency> <groupId>org.springframework.boot</groupId> <artifac ...

  3. Java多线程涉及的概念(3)

    Java多线程涉及的概念 在理解进程和线程概念之前首选要对并发有一定的感性认识,如果服务器同一时间内只能服务于一个客户端,其他客户端都再那里傻等的话,可见其性能的低下估计会被客户骂出翔来,因此并发编程 ...

  4. 吴裕雄--天生自然C++语言学习笔记:C++ 命名空间

    假设这样一种情况,当一个班上有两个名叫 Zara 的学生时,为了明确区分它们,在使用名字之外,不得不使用一些额外的信息,比如他们的家庭住址,或者他们父母的名字等等. 同样的情况也出现在 C++ 应用程 ...

  5. .NET via C#笔记5——基元类型,引用类型和值类型

    5 基元类型,引用类型和值类型 5.3 值类型的装箱和拆箱 将值类型转化为引用类型需要进行装箱(boxing) 赋值,传参等操作,如果从值类型转为引用类型,都会进行装箱 装箱的代价比较大 申请一块堆内 ...

  6. UVA - 10886 Standard Deviation (标准差)(数论)

    题意:下面是一个随机数发生器.输入seed的初始值,你的任务是求出它得到的前n个随机数标准差,保留小数点后5位(1<=n<=10000000,0<=seed<264). 分析: ...

  7. [Mathematics][Fundamentals of Complex Analysis][Small Trick] The Trick on drawing the picture of sin(z), for z in Complex Plane

    Exercises 3.2 21. (a). For $\omega = sinz$, what is the image of the semi-infinite strip $S_1 = \{x+ ...

  8. 刷题之Implement strStr()、Climbing Stairs

    public class Solution { public int strStr(String haystack, String needle) { int big = haystack.lengt ...

  9. Swift字符串截取与Range使用

    1.String.Index String.Index表示一个位置,使用String与String.Index可以获取该位置的Character let str = "123456789&q ...

  10. swift中block的使用

    在OC中习惯用block来传值,而swift中,block被重新定义了一下,叫闭包: 使用的技巧:谁定义谁传值:   案例使用A.B控制器: 1~4步在B中执行,最后在A中执行: - B控制器: 1- ...