translate动画实例
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta charset="UTF-8">
<title>translate</title>
<style>
.fangshan {
margin: 100px auto 0 auto;
width: 200px;
height: 600px;
}
.box2 {
width: 200px;
height: 200px;
border-radius: 50%;
border: 1px solid #000;
position: relative;
}
#nob1 {
width: 50px;
height: 50px;
border-radius: 50%;
background: #000;
position: absolute;
left: 38%;
top: 38%;
z-index: 3;
}
.nob {
width: 50px;
height: 100px;
border-radius: 50%;
position: absolute;
top: 0;
left: 78px;
}
#nob2 {
background: red;
transform-origin: 50% bottom;
transition: transform 1s linear;
}
#nob3 {
transform: rotate(240deg);
left: 75px;
top: 0px;
background: green;
transform-origin: 50% bottom;
transition: transform 1s linear;
}
#nob4 {
transform: rotate(120deg);
left: 75px;
top: 0px;
background: blue;
transform-origin: 50% bottom;
transition: transform 1s linear;
}
.shu {
width: 20px;
height: 300px;
background: #ccc;
box-shadow: 2px 0 2px 2px #dedede;
margin-left: 87px;
position: relative;
}
.pan {
width: 200px;
height: 50px;
border-radius: 50%;
margin-top: -25px;
background: #ccc;
}
.n {
position: absolute;
width: 15px;
height: 15px;
border-radius: 50%;
background: #aaa;
color: #fff;
left: 2.5px;
text-align: center;
cursor: pointer;
}
#n1 {
top: 50px;
}
#n2 {
top: 80px;
}
#n3 {
top: 110px;
}
#n4 {
top: 140px;
}
</style>
</head>
<body>
<div class="fangshan">
<div class="box2">
<div id="nob1"></div>
<div class="nob" id="nob2"></div>
<div class="nob" id="nob3"></div>
<div class="nob" id="nob4"></div>
</div>
<div class="shu">
<div class="n" id="n1">1</div>
<div class="n" id="n2">2</div>
<div class="n" id="n3">3</div>
<div class="n" id="n4">关</div>
</div>
<div class="pan"></div>
</div>
<script>
var n1 = document.getElementById("n1");
var n2 = document.getElementById("n2");
var n3 = document.getElementById("n3");
var n4 = document.getElementById("n4");
var i=1;
var interval;
function change3(num){
nob2.style.transform = "rotate("+i*360+"deg)";
nob2.style.transition = "transform "+num+"ms linear";
var num2 = i*360+240;
nob3.style.transform = "rotate("+num2+"deg)";
nob3.style.transition = "transform "+num+"ms linear";
var num3 = i*360+120;
nob4.style.transform = "rotate("+num3+"deg)";
nob4.style.transition = "transform "+num+"ms linear";
i++;
}
n1.onclick=function(){
clearInterval(interval);
change3(1000);
interval = setInterval(function(){
change3(1000);
},1000);
};
n2.onclick=function(){
clearInterval(interval);
change3(500);
interval = setInterval(function(){
change3(500);
},500);
};
n3.onclick=function(){
clearInterval(interval);
change3(200);
interval = setInterval(function(){
change3(200);
},200);
};
n4.onclick=function(){
clearInterval(interval);
};
</script>
</body>
</html>
translate动画实例的更多相关文章
- CSS动画:Transform中使用频繁的scale,rotate,translate动画
动画中,skew只是transform中的一种形式的动画,我们还可以学习scale,rotate,translate.这是目前使用比较频繁的属性动作. 1.scale动画的定义:(单位数值) scal ...
- css3动画实例测试
1.css3动画属性分析(2016-5-11) 1.transition: 规定属性变换规则,可以这样讲.transition(a,b,c,d); a:要变换的属性: b:过渡时间: c:运动方式: ...
- CSS动画实例:Loading加载动画效果(三)
3.小圆型Loading 这类Loading动画的基本思想是:在呈现容器中定义1个或多个子层,再对每个子层进行样式定义,使得其均显示为一个实心圆形,最后编写关键帧动画控制,使得各个实心圆或者大小发生改 ...
- CSS动画实例:太极图在旋转
利用CSS可以构造出图形,然后可以对构造的图形添加动画效果.下面我们通过旋转的太极图.放大的五角星.跳“双人舞”的弯月等实例来体会纯CSS实现动画的方法. 1.旋转的太极图 设页面中有<div ...
- CSS动画实例:移动的眼珠子
适当地利用CSS的box-shadow可以构造图形,然后可以对构造的图形添加动画效果.下面我们通过移动的眼珠子.圆珠一二三.一分为四.四小圆旋转扩散等实例来体会box-shadow属性在动画制作中的使 ...
- HTML5动画实例
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- CSS Clip剪切元素动画实例
1.CSS .fixed { position: fixed; width: 90px; height: 90px; background: red; border: 0px solid blue; ...
- Vue 案例 列表动画实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- css3 动画实例
animation 动画 animation-duration 代码实例: <!DOCTYPE html> <html> <head> <meta chars ...
随机推荐
- C# 圆角button
因为自带的button是尖角的不太好看 这里在网上找的一份代码改改做个自用的button,画的操作不局限于button也可以画其他的 using System; using System.Collec ...
- html和css入门 (一)
HTML简介 什么是HTML HTML 的全称为 超文本标记语言(Hyper Text Markup Language),这种语言给我们提供一种建立结构性文档的方法.通过表示结构性的标签语法,我们可以 ...
- CSS3字体火焰燃烧效果
动画的CSS: // fire @keyframes fireDiv { 0% { text-shadow: 0 0 4px white, 0 -5px 4px #ff3, 2px -10px 6px ...
- Java 开源博客 Solo 1.5.0 发布 - 新皮肤
Solo 1.5.0 正式发布了!这个版本主要是加入了 一款新皮肤 next,感谢一直以来关注和支持我们的朋友! 只需一个命令即可启动(不需要安装数据库.部署容器):也可以通过 war 方式部署容器, ...
- JDBC中常用对象介绍
JDBC中的主要类(接口) 在JDBC中常用的类有: 1.DriverManager 2.Connection 3.Statement 4.ResultSet 1.DriverManager 其实我们 ...
- GAN背后的数学原理
模拟上帝之手的对抗博弈——GAN背后的数学原理 简介 深度学习的潜在优势就在于可以利用大规模具有层级结构的模型来表示相关数据所服从的概率密度.从深度学习的浪潮掀起至今,深度学习的最大成功在于判别式 ...
- linux socket中tcp的time_wait的快速回收和重用
解决方法: 我们可以通过调整内核参数来调整: vi /etc/sysctl.conf 编辑文件,加入以下内容: net.ipv4.tcp_syncookies = net.ipv4.tcp_tw_re ...
- 平台支持的从经典部署模型到 Azure Resource Manager 的 IaaS 资源迁移
本文介绍如何才能将基础结构即服务 (IaaS) 资源从经典部署模型迁移到 Resource Manager 部署模型. 用户可以阅读有关 Azure Resource Manager 功能和优点的更多 ...
- Oracle 检查表的数据变动
本知识点仅适用于Oracle 9i以上的版本. 查看表的数据变动情况请使用SQL语句:select * from user_tab_modifications; user_tab_modificati ...
- linux 无法安装gcc, 可以试试换用 阿里的yum
1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2.下载新的CentOS-Base ...