从布局和BEC执行来看,这样的卡片是如何制作的?与飞机上的类似,这些显然不是滑块。它们的实现方式变得很有趣,当你将鼠标悬停在图片上时,图片会发生变化,但在移动版本中它只是滚动
Irking
Asked:
2024-10-18 20:28:45 +0000 UTC
在 .dxf 中有 Polyline 对象,它们本身就是圆、直线、圆弧等的数组。我需要找到拱门中心的坐标。
图书馆正在使用中import ezdxf
首先,您需要找到拱门本身,为此,您需要分割折线:
for file in glob.glob(os.path.join(old_dir_path, '*.dxf')):
# Открываем чертеж
doc = ezdxf.readfile(file)
msp = doc.modelspace()
# Получаем все объекты из разбитых полиний
polys = [poly.explode() for polyin msp if poly.dxftype() == 'LWPOLYLINE']
print(polys)
问题 - 如何分割折线?在 Nanocad 中,这是 EXPLODE 功能 - 它分割选定的对象。这在 python 中有效,但结果证明对象是某些对象<ezdxf.query.EntityQuery object at 0x79796c41ab90>- 不可能从中提取名称或属性。
有没有人做过类似的事情,请告诉我解决方案
Timich
Asked:
2024-10-18 20:08:41 +0000 UTC
我想实现一个代码,它可以立即播放使用任何音频输入设备录制的所有内容,但无需首先将所有数据保存在 mp3/wav 和类似文件中(它应该类似于检查麦克风的声音)。请告诉我:什么类实例存储所有数据以及什么方法/函数允许您从中获取数据?我在文档和源代码中查找了这些信息,但没有成功。
我读了一篇关于梳排序的文章https://thecode.media/comb-sort/,测试了代码,结果发现当因子值大于1.31时,代码开始工作不正确,尽管文章没有对此有何评论。为什么这种情况会从这个值开始发生,而不是从 1.2 或 1.4 开始发生?
// исходный массив
var arr = [];
for(let i = 0;i < 1000;i++){
arr.push(Math.random());
}
// получаем длину массива
const l = arr.length;
// оптимальное число для вычисления шага сравнения
const factor = 1.32;
// получаем точный шаг сравнения
let gapFactor = l / factor;
// пока шаг больше единицы
while (gapFactor > 1) {
// округляем шаг до целого
const gap = Math.round(gapFactor);
// и организуем цикл как в пузырьковой сортировке
for (let i = 0, j = gap; j < l; i++, j++) {
// если сначала идёт большое число
if (arr[i] > arr[j]) {
// меняем их местами
[arr[i], arr[j]] = [arr[j], arr[i]];
}
// выводим текущее состояние массива в консоль
// это необязательный шаг, он здесь для наглядности
//console.log(arr);
}
// в конце цикла рассчитываем новый шаг
gapFactor = gapFactor / factor;
}
for(let i = 0;i < arr.length - 1;i++){
if(arr[i + 1] < arr[i]){
console.log('Массив неправильно отсортирован! ' + i);
}
}
4C697361
Asked:
2024-10-18 16:24:16 +0000 UTC
我正在制作几个单选按钮来控制对象。默认情况下,每个都应处于模式 A 中。每个都在所需位置写入checked,它们也位于单独的容器中,但只有顶部的设置了默认值。 HTML 和 CSS 之间可能存在一些冲突,如何解决?
按钮代码:
fieldset {
position: fixed;
display: flex;
justify-content: space-around;
border: 0;
text-align: center;
}
#oneSwitchBtn {
margin-top: 5%;
}
#twoSwitchBtn {
margin-top: 15%;
}
label {
display: inline-block;
position: relative;
width: 3rem;
padding-bottom: 2.5rem;
z-index: 2;
cursor: pointer;
font-family: 'Inter-bold';
color: #30d5c8;
}
label:first-of-type {
z-index: 1;
}
input {
position: absolute;
top: 0;
height: 100%;
width: 20%;
appearance: none;
background: none;
opacity: 0.000001;
}
/* focus styles ======*/
input:focus+label {
text-decoration: underline;
}
fieldset:focus-within label:first-of-type::before {
box-shadow: 0 0 0 2px white, 0 0 0 4px grey;
}
/* toggle background =========== */
label:first-of-type::before {
content: '';
position: absolute;
width: 8rem;
height: 2rem;
bottom: 0;
left: 0.5rem;
background-color: grey;
border-radius: 0.95rem;
}
/* toggle knob (thumb?) ========= */
label:last-of-type::after {
content: '';
position: absolute;
height: 1.5rem;
width: 1.5rem;
background-color: black;
border-radius: 50%;
bottom: 0.25rem;
right: 0.75rem;
transition: transform 0.3s ease;
}
input:first-of-type:checked~label:last-of-type::after {
transform: translateX(-6rem);
background-color: rgb(22, 192, 73);
}
input:nth-of-type(2):checked~label:last-of-type::after {
transform: translateX(-3rem);
background-color: rgb(70, 70, 70);
}
input:last-of-type:checked~label:last-of-type::after {
transform: translateX(0);
background-color: red;
}
/* end of toggle ================== */
<fieldset id="oneSwitchBtn">
<input name="state" value="on" id="none0" type="radio">
<label for="none0"> 0 </label>
<input name="state" value="auto" id="none01" type="radio" checked>
<label for="none01">A</label>
<input name="state" value="off" id="none02" type="radio">
<label for="none02"> 1 </label>
</fieldset>
<fieldset id="twoSwitchBtn">
<input name="state" value="on" id="none1" type="radio">
<label for="none1"> 0 </label>
<input name="state" value="auto" id="none2" type="radio" checked>
<label for="none2">A</label>
<input name="state" value="off" id="none3" type="radio">
<label for="none3"> 1 </label>
</fieldset>

