第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何彎曲svg點(diǎn)組

如何彎曲svg點(diǎn)組

猛跑小豬 2022-10-21 10:13:46
所以我正在創(chuàng)建 svg 圓圈組,需要根據(jù)用戶輸入來彎曲它們。但我無法計(jì)算正確的位置。用戶可以彎曲 3..n 個圓圈(我擁有每個圓圈的所有位置)。圖片中的示例https://i.stack.imgur.com/1YiV2.png知道如何計(jì)算曲線并將圓移動到正確的位置嗎?
查看完整描述

2 回答

?
慕碼人2483693

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超9個贊

我通過 js 為你做了關(guān)于 HTML 的曲線的事情。它可能不是最有效的,但這里是代碼:


var imgs = document.querySelectorAll("img");

let intensity = 24;

let reduction = intensity / (imgs.length-1);

for (let i = 0; i < imgs.length; i++) {

  imgs[i].style.left = i * 32 + "px"; // Use this for horizontal gap

  imgs[i].style.top = ((intensity) * (i)) + "px";

  intensity -= reduction;

}

img {

  width: 32px;

  height: 32px;

  position: absolute;

}

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>

<img src="https://www.freepngimg.com/thumb/shape/29779-8-circle-file.png"/>


查看完整回答
反對 回復(fù) 2022-10-21
?
長風(fēng)秋雁

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超7個贊

一種可能的解決方案是將點(diǎn)放在路徑上:


在下一個示例中,我正在繪制一條弧線。在這種情況下,圓弧的半徑是 100。路徑的 d 屬性是:


d="M-80,0A 100,100 0 0 1 80,0"


圓弧上的點(diǎn)是點(diǎn)劃線。為了知道使用的 stroke-dasharray 的值,我使用了 javascript:您的筆觸非常小 (.1),其后是路徑總長度的 1/5 的間隙。1/5 代表 5 個點(diǎn)。此外,我使用的 stroke-dashoffset 是路徑總長度的 1/10,即用于 stroke-dasharray 的間隙的一半


let length = thePath.getTotalLength()

thePath.setAttribute("stroke-dasharray", `.1,${length/5}`)

thePath.setAttribute("stroke-dashoffset", length/10)

svg{border:solid; }

<svg width="200" viewBox="-100 -100 200 200">

<path id="thePath" d="M-80,0A100,100 0 0 1 80,0" fill="none" stroke="black" stroke-linecap="round" stroke-width="30"/>    

</svg>

為了將點(diǎn)放在一條直線上,我將路徑更改為半徑很大的弧:在這種情況下為 1000


d="M-80,0A1000,1000 0 0 1 80,0"


let length = thePath.getTotalLength()

thePath.setAttribute("stroke-dasharray", `.1,${length/5}`)

thePath.setAttribute("stroke-dashoffset", length/10)

svg{border:solid; }

<svg width="200" viewBox="-100 -100 200 200">

<path id="thePath" d="M-80,0A1000,1000 0 0 1 80,0" fill="none" stroke="black" stroke-linecap="round" stroke-width="30"/>    

</svg>


查看完整回答
反對 回復(fù) 2022-10-21
  • 2 回答
  • 0 關(guān)注
  • 125 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號