css搖曳的_HTML5+CSS3實現樹被風吹動搖晃

1

新建html文檔。

2

書寫hmtl代碼。

3

書寫css代碼。

.trunk, .trunk div { background: #136086; width: 100px; height: 10px; position: absolute; left: 50%; top: 70%; margin-left: -10px; -webkit-animation-name: rot; animation-name: rot; -webkit-animation-duration: 2.02s; animation-duration: 2.02s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-direction: alternate; animation-direction: alternate; -webkit-transform-origin: 5px 5px; -ms-transform-origin: 5px 5px; transform-origin: 5px 5px; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; }

.trunk.trunk, .trunk div.trunk { bottom: 0; left: 50%; -webkit-animation-name: rot-root; animation-name: rot-root; -webkit-animation-duration: 2.5s; animation-duration: 2.5s; }

.trunk > div, .trunk div > div { /*opacity:0.9;*/

top: 0; left: 100px; -webkit-animation-duration: calc(inherit / 2); animation-duration: calc(inherit / 2);/* don't works ?*/

}

.trunk > div:nth-child(2), .trunk div > div:nth-child(2) { /*animation-duration:15s;*/

-webkit-animation-name: rot-inv; animation-name: rot-inv; -webkit-animation-duration: 1.7s; animation-duration: 1.7s; }

4

書寫css百分比代碼。

@-webkit-keyframes rot { ?from {

-webkit-transform: rotate(15deg) scale(0.72);

transform: rotate(15deg) scale(0.72);

}

to { -webkit-transform: rotate(45deg) scale(0.72); transform: rotate(45deg) scale(0.72); }

}

@keyframes rot { ?from {

-webkit-transform: rotate(15deg) scale(0.72);

transform: rotate(15deg) scale(0.72);

}

to { -webkit-transform: rotate(45deg) scale(0.72); transform: rotate(45deg) scale(0.72); }

}

@-webkit-keyframes rot-inv { ?from {

-webkit-transform: rotate(-45deg) scale(0.72);

transform: rotate(-45deg) scale(0.72);

}

to { -webkit-transform: rotate(-15deg) scale(0.72); transform: rotate(-15deg) scale(0.72); }

}

@keyframes rot-inv { ?from {

-webkit-transform: rotate(-45deg) scale(0.72);

transform: rotate(-45deg) scale(0.72);

}

to { -webkit-transform: rotate(-15deg) scale(0.72); transform: rotate(-15deg) scale(0.72); }

}

@-webkit-keyframes rot-root { ?from {

-webkit-transform: rotate(-95deg);

transform: rotate(-95deg);

}

to { -webkit-transform: rotate(-85deg); transform: rotate(-85deg); }

}

@keyframes rot-root { ?from {

-webkit-transform: rotate(-95deg);

transform: rotate(-95deg);

}

to { -webkit-transform: rotate(-85deg); transform: rotate(-85deg); }

}

5

代碼整體結構。

6

查看效果。

END

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/457526.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/457526.shtml
英文地址,請注明出處:http://en.pswp.cn/news/457526.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

素數路(prime)

素數路(prime) 題目描述 已知一個四位的素數,要求每次修改其中的一位,并且要保證修改的結果還是一個素數,還不能出現前導零。你要找到一個修改數最少的方案,得到我們所需要的素數。 例如把1033變到8179,這里是一個最短…

python多線程單核_002_Python多線程相當于單核多線程的論證

很多人都說python多線程是假的多線程!下面進行論證解釋:一、我們先明確一個概念,全局解釋器鎖(GIL)Python代碼的執行由Python虛擬機(解釋器)來控制。Python在設計之初就考慮要在主循環中,同時只有一個線程在執行,就像單CPU的系統中運行多個進…

detail:JSON parse error - Expecting value: line 1 column 1 (char 0)

detail":"JSON parse error - Expecting value: line 1 column 1 (char 0) 在調用接口時返回400錯誤,詳情是 {detail":"JSON parse error - Expecting value: line 1 column 1 (char 0)"}原因是傳送數據的格式有問題,不要使用…

【IDEA 2016】intellij idea tomcat jsp 熱部署

剛開始用IDEA,落伍的我,只是覺得IDEA好看。可以換界面。想法如此的low。 真是不太會用啊,弄好了tomcat。程序啟動竟然改動一下就要重啟,JSP頁面也一樣。 IDEA可以配置熱部署,打開tomcat配置頁面,將紅框處&a…

C# where用法解析

where 子句用于指定類型約束&#xff0c;這些約束可以作為泛型聲明中定義的類型參數的變量。1.接口約束。例如&#xff0c;可以聲明一個泛型類 MyGenericClass&#xff0c;這樣&#xff0c;類型參數 T 就可以實現 IComparable<T> 接口&#xff1a;public class MyGeneric…

ubuntu進入桌面自動啟動腳本_在 Ubuntu 下開機自啟動自己的 QT 程序而不啟動 Ubuntu 的桌面...

1. /etc/profile 方式實現這個功能&#xff0c;要完成兩步&#xff1a;1、系統設置-> 用戶賬戶-> 點擊我的賬戶-> 點擊右上角的解鎖-> 打開自動登錄-> 點擊右上角的鎖定-> 退出系統設置2、在 /etc/profile 文件的開頭添加執行 qt 程序的命令。如&#xff1a;…

Java obj與JSON互轉(jackson)

JSON 解析 常見的json解析器&#xff1a; jsonlibGson(谷歌)fastjson(阿里)jackson(Spring內置) jackson 依賴jar包 jackson-annotations/jackson-core/jackson-databind/ 官網下載地址 1. Java對象轉JSON 1.1 核心對象 ObjectMapper 1.2常用轉換方法 writeValue(參…

如何制作一個簡單的APP應用軟件?

如今隨著移動智能手機的普及&#xff0c;讓APP的市場一片繁榮&#xff0c;現在市場上的APP數量數不勝數&#xff0c;對于APP開發的我們很多外行人也許認為&#xff0c;開發APP是不是特別難&#xff0c;是不是只有資歷很高的程序員才能夠完成這個任務&#xff0c;或者說要想開發…

I/O重定向

每個進程都至少有3個信息&#xff1a;“標準輸入”stdin、“標準輸出”stdout、和“標準出錯”stderr。標準輸入通常來自鍵盤&#xff0c;標準輸出和標準錯誤輸出通常被發往屏幕&#xff08;并不會保存在磁盤文件中&#xff09;。有些時候&#xff0c;需要從文件讀取輸入&#…

java 自動裝拆箱

title: “java 自動裝拆箱” tags: Java 將基本數據類型封裝成對象的過程叫做裝箱&#xff08;boxing&#xff09;&#xff0c;反之基本數據類型對應的包裝類轉換為基本數據類型的過程叫做拆箱&#xff08;unboxing&#xff09;; 基本數據類型與其他對象的區別 基本數據類型 …

設計模式11---組合模式(Composite Pattern)

一、組合模式定義 將對象組合成樹形結構以表示“部分-整體”的層次結構&#xff0c;使得用戶對單個對象和組合對象的使用具有一致性。Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compos…

Linux 多核下綁定硬件中斷到不同 CPU(IRQ Affinity)

轉載 - Linux 多核下綁定硬件中斷到不同 CPU&#xff08;IRQ Affinity&#xff09; 作者 digoal 日期 2016-11-20 標簽 Linux , IRQ , 中斷 , CPU親和 , 綁定中斷處理CPU 背景 原文 http://www.vpsee.com/2010/07/load-balancing-with-irq-smp-affinity/ 原文 硬件中斷發生頻繁…

請列舉你了解的分布式鎖_這幾種常見的“分布式鎖”寫法,搞懂再也不怕面試官,安排!...

什么是分布式鎖&#xff1f;大家好&#xff0c;我是jack xu&#xff0c;今天跟大家聊一聊分布式鎖。首先說下什么是分布式鎖&#xff0c;當我們在進行下訂單減庫存&#xff0c;搶票&#xff0c;選課&#xff0c;搶紅包這些業務場景時&#xff0c;如果在此處沒有鎖的控制&#x…

leetcode 268

等差數列求值 1 class Solution {2 public:3 int missingNumber(vector<int>& nums) {4 int nnums.size();5 int kn*(n1)/2;6 for(int i0;i<n;i)7 k-nums[i];8 return k;9 } 10 }; 轉載于:https://www.cnblogs.…

301緩存重定向?301 Moved Permanently (from disk cache)

今天在寫一個博客系統時&#xff0c;發現首頁數據經常刷新不出來&#xff0c;甚至后端根本就沒有接受到這個請求&#xff0c;以為是Ajax的問題&#xff0c;但通過抓包發現Ajax請求確實已經發出去了&#xff0c;但狀態碼是 301 Moved Permanently (from disk cache),301是永久重…

Firefox 50優化Electrolysis

Mozilla正式發布Firefox 50。最新的版本中提升了來自多個內容進程用戶的用戶體驗&#xff0c;并修復了十幾個高影響的安全漏洞。\\在Firefox最新版本的變更中&#xff0c;我們注意到了它對于Electrolysis的進一步改進。Electrolysis是Mozilla實現在后臺進程中呈現和執行web相關…

ModuleNotFoundError: No module named '_ctypes' ERROR:Command errored out with exit status 1: python

Ubuntu下載 nginx 時報錯&#xff1a; ERROR: Command errored out with exit status 1:command: /usr/local/bin/python3.7 -c import sys, setuptools, tokenize; sys.argv[0] ""/tmp/pip-install-7e0xdb36/uwsgi/setup.py""; __file__""/tmp…

python opc plc_PYthon簡易OPC數據采集寫入Access

利用hollias comm opcserver 與Python實現交互。代碼如下&#xff1a;# -*- coding: utf-8 -*-from sys import *from getopt import *#from os import * 造成f open(test.txt, r) TypeError: an integer is required錯誤import signalimport sysimport osimport typesimport …

邊工作邊刷題:70天一遍leetcode: day 73

Read N Characters Given Read4 I/II 要點&#xff1a;這題的要點就是搞清楚幾個變量的內在邏輯&#xff1a;只有buffer是整4 bytes的。而client要讀的bytes&#xff08;需求&#xff09;和實際上disk上有的bytes&#xff08;供給&#xff09;都是不整的。所以&#xff0c; 循環…

javascript時間戳和日期字符串相互轉換

1 <html xmlns"http://www.w3.org/1999/xhtml">2 <head>3 <meta http-equiv"Content-Type" content"text/html; charsetutf-8" />4 <script type"text/javascript">5 // 獲取當前時間戳(以s為單位)6 var time…