css---2D变形
1.transfrom:rotate(360deg); 用前要加transition: 2s; deg重点
transform:rotate(angle);
正值:顺时针旋转 rotate(360deg)
负值:逆时针旋转 rotate(-360deg)
只能设单值。正数表示顺时针旋转,负数表示逆时针旋转
transform: rotate(360deg);
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#test{
width: 200px;
height: 200px; border:3px solid red;
background: pink;
text-align: center;
font: 20px/200px "微软雅黑" ; position: absolute;
left: ;
right: ;
bottom: ;
top: ;
margin: auto;
transition: 2s; }
html{
height: %;
}
html body{
height: %;
border: 3px solid yellow;
margin-top: 100px; }
body:hover #test{
transform: rotate(360deg);
} </style> </head>
<body>
<div id="test">
transform
</div>
</body>
</html>
tansation:rotate
X方向平移:transform: translateX(tx)
Y方向平移:transform: translateY(ty)
二维平移:transform: translate(tx[, ty]); 如果ty没有指定,它的值默认为0。
可设单值,也可设双值。
正数表示XY轴正向位移,负数为反向位移。设单值表示只X轴位移,Y轴坐标不变,
例如transform: translate(100px);等价于transform: translate(100px,0);
transform:translateX(300px);
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#test{
width: 200px;
height: 200px; border:3px solid red;
background: pink;
text-align: center;
font: 15px/200px "微软雅黑" ; position: absolute;
left: ;
right: ;
bottom: ;
top: ;
margin: auto;
transition: 2s; }
html{
height: %;
}
html body{
height: %;
border: 3px solid yellow;
margin-top: 100px; }
body:hover #test{
transform:translateX(300px);
} </style> </head>
<body>
<div id="test">
transform:translateX(300px);
</div>
</body>
</html>
tranlateX
倾斜 skew
X方向倾斜:transform: skewX(angle)
skewX(45deg):参数值以deg为单位 代表与y轴之间的角度
Y方向倾斜:transform: skewY(angle)
skewY(45deg):参数值以deg为单位 代表与x轴之间的角度
二维倾斜:transform: skew(ax[, ay]); 如果ay未提供,在Y轴上没有倾斜
skew(45deg,15deg):参数值以deg为单位 第一个参数代表与y轴之间的角度
第二个参数代表与x轴之间的角度
单值时表示只X轴扭曲,Y轴不变,如transform: skew(30deg);等价于 transform: skew(30deg, 0);
考虑到可读性,不推荐用单值,应该用transform: skewX(30deg);。skewY表示 只Y轴扭曲,X轴不变
正值:拉正斜杠方向的两个角
负值:拉反斜杠方向的两个角
transform:skewX(45deg);
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#test{
width: 200px;
height: 200px; border:3px solid red;
background: pink;
text-align: center;
font: 15px/200px "微软雅黑" ; position: absolute;
left: ;
right: ;
bottom: ;
top: ;
margin: auto;
transition: 2s; }
html{
height: %;
}
html body{
height: %;
border: 3px solid yellow;
margin-top: 100px; }
body:hover #test{
transform:skewX(45deg);
} </style> </head>
<body>
<div id="test">
transform:skewX(45deg);
</div>
</body>
</html>
Skew
缩放Scale
transform:scale(2);
X方向缩放:transform: scaleX(sx);
Y方向缩放:transform: scaleY(sy);
二维缩放 :transform: scale(sx[, sy]); (如果sy 未指定,默认认为和sx的值相同)
要缩小请设0.01~0.99之间的值,要放大请设超过1的值。
例如缩小一倍可以transform: scale(.5);
放大一倍可以transform: scale(2);
如果只想X轴缩放,可以用scaleX(.5)相当于scale(.5, 1)。
同理只想Y轴缩放,可以用scaleY(.5)相当于scale(1, .5)
正值:缩放的程度
负值:不推荐使用(有旋转效果)
单值时表示只X轴,Y轴上缩放粒度一样,如transform: scale(2);等价于transform: scale(2,2);
transform:scale();
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#test{
width: 200px;
height: 200px; border:3px solid red;
background: pink;
text-align: center;
font: 15px/200px "微软雅黑" ; position: absolute;
left: ;
right: ;
bottom: ;
top: ;
margin: auto;
transition: 2s; }
html{
height: %;
}
html body{
height: %;
border: 3px solid yellow;
margin-top: 100px; }
body:hover #test{
transform:scale();
} </style> </head>
<body>
<div id="test">
transform:scale();
</div>
</body>
</html>
scale
基点的转换 transform-origin:left top;
transform-origin: left top;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#test{
width: 200px;
height: 200px; border:3px solid red;
background: pink;
text-align: center;
font: 15px/100px "微软雅黑" ; position: absolute;
left: ;
right: ;
bottom: ;
top: ;
margin: auto;
transition: 2s;
transform-origin: left top; }
html{
height: %;
}
html body{
height: %;
border: 3px solid yellow;
margin-top: 100px; }
body:hover #test{
transform:rotate(360DEG);
} </style> </head>
<body>
<div id="test">
transform-origin: left top;基点转换
</div>
</body>
</html>
transform-origin
最新文章
- 达洛克战记3 即将开服! What&#39;s New!
- C#变量类型
- BZOJ-1925 地精部落 烧脑DP+滚动数组
- Java字符判断
- Grid行编辑插件
- C++关键字 inline
- 转-----实现基本的Ajax和Json请求
- Linux Kernel basics
- 【C语言探索之旅】 第一部分第四课第一章:变量的世界之内存那档事
- Redis源代码分析(十一年)--- memtest内存测试
- Android 手机应用开发经验 之 通过Socket(TCP/IP)与PC通讯
- HTTP协议的消息头:Content-Type和Accept的作用
- [HDU 2036]改革春风吹满地
- python爬虫入门(四)利用多线程爬虫
- 图解java中的bytebuffer
- 在Android中afinal框架下實現sqlite數據庫版本升級的辦法
- python - argparse 模块学习
- linux编译安装aria2
- JAVA学习笔记--数组初始化
- 华为笔试——C++进制转换
热门文章
- 连接分析算法-HITS-算法
- 我要多开梦幻手游PC端(梦幻手游PC端多开的简单分析及实现办法)(二)
- [转]PHP base64_encode 在URL地址参数编码上使用
- 理解TCP/IP,SOCKET,HTTP,FTP,RMI,RPC,webservic
- bzoj1051题解
- IDEA maven package失败
- NX二次开发-UFUN点收集器UF_UI_select_point_collection
- (转)Android 创建与解析XML—— Dom4j方式 .
- HDU6315 Naive Operations 线段树
- word2vec中关于霍夫曼树的