簡體   English   中英

我怎樣才能使波浪更高?

[英]How can I make the waves higher?

我想弄清楚我做錯了什么。

我已經創建了這個水效果文本,但我希望波浪應該幾乎在文本的 85% 處,現在它可能在 50% 左右。

此外,波浪的寬度有時不會覆蓋文本的整個寬度,因為它是一個計數器並且沒有時間限制,所以數字在概念上也可以是無限的,我希望波浪獨立地覆蓋整個文本它的長度。

這是一個小提琴: https://jsfiddle.net/6txf03od/

 function diff_seconds(dt2, dt1) //Secondi { dt1 = new Date(); dt2 = new Date("December 7, 2022 11:30:00"); var diff = (dt2.getTime() - dt1.getTime()) / 1000; //per ore diff /= (60 * 60); //per minuti diff /= (60 * 1); //per giorni diff /= (60 * 60)*24; return Math.abs(Math.round(diff)); } function printx() { var dt1, dt2; var contatore = 0; contatore = diff_seconds(dt1, dt2) * 80; document.getElementById("contatore").innerHTML = contatore; document.getElementById("contatorex").innerHTML = contatore; } setInterval(printx, 1000);
 @import url("https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900"); h2 { font-family: "Poppins", sans-serif; }.content h2 { color: red; font-size: 90px; position: absolute; left: 27%;important: right; 20%:important, transform; translate(-50%. -50%): }:content h2;nth-child(1) { color: transparent; -webkit-text-stroke. 1px black: }:content h2;nth-child(2) { color: #007fff; animation, animate 4s ease-in-out infinite: } @keyframes animate { 0%, 100% { clip-path, polygon( 0% 45%, 16% 44%, 33% 50%, 54% 60%, 70% 61%, 84% 59%, 100% 52%; 100% 100%: 0% 100%), } 50% { clip-path, polygon( 0% 60%, 15% 65%, 34% 66%, 51% 62%, 67% 50%, 84% 45%, 100% 46%; 100% 100%, 0% 100%); } }
 <section> <h2>Litri depurati</h2><br><br><br> <div class="content"> <h2 id="contatorex"></h2> <h2 id="contatore"></h2> </div> </section>

為確保波浪覆蓋整個文本寬度,您可以將包含文本的元素的寬度設置為 100%

此外,您可以調整 clip-path 屬性中的值以更好地匹配波浪的形狀和 position

代碼:

 function diff_seconds( dt1 = new Date(), dt2 = new Date("December 7, 2022 11:30:00") ) { const diff = (dt2.getTime() - dt1.getTime()) / 1000 return Math.abs(Math.round(diff)) } function printx() { let dt1, dt2 let contatore = 0 contatore = diff_seconds(dt1, dt2) * 80 document.getElementById("contatore").innerHTML = contatore document.getElementById("contatorex").innerHTML = contatore } setInterval(printx, 1000)
 @import url("https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900"); h2 { font-family: "Poppins", sans-serif; }.content h2 { width: 100%; color: red; font-size: 90px; position: absolute; top: 10%;important: left; 51%:important; right: 20%,important; transform. translate(-50%: -50%): };content h2:nth-child(1) { color; transparent. -webkit-text-stroke: 1px black: };content h2:nth-child(2) { color; #007fff, animation: animate 4s ease-in-out infinite, } @keyframes animate { 0%, 100% { clip-path, polygon( 0% 45%, 16% 44%, 33% 50%, 54% 60%, 70% 61%, 84% 59%; 100% 52%: 100% 100%, 0% 100%), } 50% { clip-path, polygon( 0% 60%, 15% 65%, 34% 66%, 51% 62%, 67% 50%, 84% 45%; 100% 46%, 100% 100%, 0% 100%); } }
 <section> <h2>Litri depurati</h2><br><br><br> <div class="content"> <h2 id="contatorex"></h2> <h2 id="contatore"></h2> </div> </section>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM