CSS3简单的空调

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{margin:0; padding:0;}
.main{width:400px; height:340px; margin-top:150px; margin-left:150px;}
.main .container{width:300px; height:150px; position:relative; perspective:150px;}
.main .container .box{width:100%; height:100%; position:absolute; transform-style:preserve-3d;}
.main .container .box figure{display:block; position:absolute;}
.main .container .box .front{width:300px; height:150px; background-color:rgba(255, 160, 122, .7);}
.main .container .box .front h1{width:50px; height:20px; line-height:20px; text-align:center; font-size:14px; color:#FFF; margin-left:20px; margin-top:20px;}
.main .container .box .front span{width:60px; height:30px; line-height:35px; font-size:20px; color:#FFF; text-align:center; position:absolute; top:40px; right:30px; background-color:rgba(95, 95, 95, 1); display:inline-block; border-radius:5px;}
.main .container .box .front .light-1{width:6px; height:6px; border-radius:6px; background-color:#ceccc8; position:absolute; top:85px; right:40px; display:inline-block;}
.main .container .box .front .light-2{width:6px; height:6px; border-radius:6px; background-color:#ceccc8; position:absolute; top:85px; right:60px; display:inline-block;}
.main .container .box .front .light-2.active{background-color:#56FA0A; box-shadow:0 0 10px 1px #FFF;}
.main .container .box .back{width:300px; height:150px; transform:translateZ(-20px); background-color:rgba(50, 50, 50, 1);}
.main .container .box .right{width:20px; height:150px; left:290px; transform:translateZ(-10px) rotateY(90deg); background-color:rgba(254, 205, 82, .8);}
.main .container .box .left{width:20px; height:150px; left:-10px; transform:translateZ(-10px) rotateY(-90deg); background-color:rgba(254, 205, 82, .8);}
.main .container .box .top{width:300px; height:20px; top:-10px; transform:translateZ(-10px) rotateX(90deg); background-color:rgba(18, 20, 80, .8);}
.main .container .box .bottom{width:300px; height:20px; top:140px; transform:translateZ(-10px) rotateX(-90deg); background-color:rgba(18, 20, 80, .8); box-shadow:40px -10px 30px 4px gray;}
.main .container .box .div-1{width:260px; height:10px; position:absolute; top:110px; left:20px; background-color:rgba(255, 255, 255, .8); transform:translateZ(-5px) rotateX(90deg);}
.main .container .box .div-1:nth-of-type(2){top:120px;}
.animate-cycle{animation:cycle 12s linear infinite both;}
@keyframes cycle{
0% {transform:translateZ(-5px) rotateX(90deg);}
25% {transform:translateZ(-5px) rotateX(20deg);}
50% {transform:translateZ(-5px) rotateX(90deg);}
75% {transform:translateZ(-5px) rotateX(160deg);}
100% {transform:translateZ(-5px) rotateX(90deg);}
}
.main .box-1{width:80px; height:150px; border:1px solid #F57E0F; margin-top:20px; margin-left:20px; background-color:#19e6f8;}
.main .box-1 span{width:50px; height:25px; background-color:#F57E0F; color:#FFF; display:block; line-height:25px; text-align:center; margin-top:10px; margin-left:15px; font-size:14px; cursor:pointer;}
.main .box-1 span:hover{background-color:#fcd05a;}
</style>
</head>
<body>
<div class="main">
<div class="container">
<div class="box">
<figure class="front">
<h1>GREE</h1>
<span id="num">18 ºC</span>
<div class="light-1"></div>
<div class="light-2" id="light"></div>
</figure>
<figure class="back"></figure>
<figure class="right"></figure>
<figure class="left"></figure>
<figure class="top"></figure>
<figure class="bottom"></figure>
<div class="div-1" id="div_1"></div>
<div class="div-1" id="div_2"></div>
</div><!--box-->
</div><!--container-->
<div class="box-1">
<span id="openOrClose">开/关</span>
<span id="add">+</span>
<span id="reduce">-</span>
<span id="wind">风向</span>
</div><!--box-1-->
</div><!--main-->
<script>
window.onload = function(){

var getIdObject = function(id){
return document.getElementById(id);
}
var openOrClose = getIdObject(‘openOrClose‘),
add = getIdObject(‘add‘),
reduce = getIdObject(‘reduce‘),
wind = getIdObject(‘wind‘),
num = getIdObject(‘num‘),
light = getIdObject(‘light‘),
div_1 = getIdObject(‘div_1‘),
div_2 = getIdObject(‘div_2‘),
windStatus = 0,
status = 0;
openOrClose.onclick = function(){
if(!status){
status = 1;
light.className = ‘light-2 active‘;
}else{
status = 0;
light.className = ‘light-2‘;
windStatus = 0;
div_1.className = ‘div-1‘;
div_2.className = ‘div-1‘;
}
}
add.onclick = function(){
var numVal = parseInt(num.innerHTML);
if(!status || numVal >= 32){
return;
}else{
num.innerHTML = ++numVal + ‘ ºC‘;
}
}
reduce.onclick = function(){
var numVal = parseInt(num.innerHTML);
if(!status || numVal <= 16){
return;
}else{
num.innerHTML = --numVal + ‘ ºC‘;
}
}
wind.onclick = function(){
if(!status) return;
if(!windStatus){
windStatus = 1;
div_1.className = ‘div-1 animate-cycle‘;
div_2.className = ‘div-1 animate-cycle‘;
}else{
windStatus = 0;
div_1.className = ‘div-1‘;
div_2.className = ‘div-1‘;
}
}

}
</script>
</body>
</html>

时间: 2024-10-27 17:37:48

CSS3简单的空调的相关文章

[原创]css3简单几步画一个乾坤图

效果如上,鼠标移上去会有动画. 代码如下非常简单: 1 <html> 2 <head> 3 <style> 4 .outer{height:100px;width:200px;border-radius:100px 100px 0px 0px;border:solid 1px #666;border-bottom:none; margin:0 auto;background:#fff;overflow:hidden;} 5 .inner{width:300px;heig

css3 简单界面动画

asdasdasdasda asdasdasdasdacss3 简单界面动画,布布扣,bubuko.com

css3简单几步画一个乾坤图

原文:[原创]css3简单几步画一个乾坤图 效果如上,鼠标移上去会有动画. 代码如下非常简单: 1 <html> 2 <head> 3 <style> 4 .outer{height:100px;width:200px;border-radius:100px 100px 0px 0px;border:solid 1px #666;border-bottom:none; margin:0 auto;background:#fff;overflow:hidden;} 5 .

javascript+css3简单的手风琴效果

<!DOCTYPE html> <html> <head>     <meta charset="utf-8">     <title>javascript+css3简单的手风琴效果</title> <style>#imageMenu{width:500px;height:200px;overflow:hidden;}#imageMenu ul *{transition:all linear 0.2s;

CSS3简单动画

css3的动画确实非常绚丽!浏览器兼容性很重要!. 分享两个小动画 <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus®"> <meta name="Author" content=&qu

H5+CSS3简单动画 知识点 汇总

乱入几个:  1.h5的一个语义化标签 figure :用于规定独立的流内容(图像 图表 照片 代码等) figcapition:与figure配套使用,用于标签定义figure元素标题 2.媒体查询: 通过不同的媒体类型和条件定义样式规则 :媒体查询大部分媒体特性都接受min和max 用于表示"大于等于"或"小于等于":width: min-width;max-width 媒体查询可以用在@media和import规则上,也可以用在HTML和XML中. @medi

css3简单介绍

关于css3我先介绍几个简单的选择器: 先进行设置: 字符串匹配属性选择器: E[alt^="a"]  选择属性中以a开头的元素: E[alt$="a"]  选择属性中以a结尾的元素: E[alt*="a"]  选择属性中包含a的元素: 见以下例子: 结果如下: 伪类选择器: 先看以下的例子: 结果: 以上是几个选择器作用的结果,下面我依次讲解例子中各选择器的作用: 1.E:nth-child():匹配父元素中的第几个子元素 2.E:nth-la

css3简单实现图片模糊过滤效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <meta http-equiv="Cont

css3 简单动画

<script> <!-- var x,y,n=0,ny=0,rotINT,rotYINT function rotateDIV() { x=document.getElementById("rotate1") clearInterval(rotINT) rotINT=setInterval("startRotate()",10) } function rotateYDIV() { y=document.getElementById("r