RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-205037

Дмитрий Полянин's questions

Martin Hope
Дмитрий Полянин
Asked: 2022-02-12 18:19:19 +0000 UTC

如何在 SVG 中围绕图像制作光环轮廓?

  • 3

我有一个 SVG 绘图,示例代码如下。

需要通过过滤器在整个图片周围制作一个宽度为N像素的白色光晕轮廓。

有必要找到一个解决方案,而不是针对这个特定的绘图,而是一个我可以应用于任何绘图的过滤器。例如,文本或一组形状。

问题的上下文是为 Telegram 创建贴纸,其中光环轮廓是推荐的组件。

div {
background-color: blue;
}
<div>
<svg id="placeholder" width="600" height="600" version="1.1" viewBox="-120 -120 240 240" preserveAspectRatio="none">
  <path d="M25.9-96.6C38.3-92.4 41.3-99.8 54-93.5 65.7-85.7 60.9-79.3 70.7-70.7 79.3-60.9 85.7-65.7 93.5-54 99.8-41.3 92.4-38.3 96.6-25.9 99.1-13.1 107.1-14.1 108 0 107.1 14.1 99.1 13.1 96.6 25.9 92.4 38.3 99.8 41.3 93.5 54 85.7 65.7 79.3 60.9 70.7 70.7 60.9 79.3 65.7 85.7 54 93.5 41.3 99.8 38.3 92.4 25.9 96.6 13.1 99.1 14.1 107.1 0 108 -14.1 107.1-13.1 99.1-25.9 96.6 -38.3 92.4-41.3 99.8-54 93.5 -65.7 85.7-60.9 79.3-70.7 70.7 -79.3 60.9-85.7 65.7-93.5 54 -99.8 41.3-92.4 38.3-96.6 25.9 -99.1 13.1-107.1 14.1-108 0 -107.1-14.1-99.1-13.1-96.6-25.9 -92.4-38.3-99.8-41.3-93.5-54 -85.7-65.7-79.3-60.9-70.7-70.7 -60.9-79.3-65.7-85.7-54-93.5 -41.3-99.8-38.3-92.4-25.9-96.6 -13.1-99.1-14.1-107.1 0-108 14.1-107.1 13.1-99.1 25.9-96.6 38.3-92.4 41.3-99.8 54-93.5 65.7-85.7 60.9-79.3 70.7-70.7 79.3-60.9 85.7-65.7 93.5-54 99.8-41.3 92.4-38.3 96.6-25.9 99.1-13.1 107.1-14.1 108 0 107.1 14.1 99.1 13.1 96.6 25.9 92.4 38.3 99.8 41.3 93.5 54 85.7 65.7 79.3 60.9 70.7 70.7 60.9 79.3 65.7 85.7 54 93.5 41.3 99.8 38.3 92.4 25.9 96.6 13.1 99.1 14.1 107.1 0 108 -14.1 107.1-13.1 99.1-25.9 96.6 -38.3 92.4-41.3 99.8-54 93.5 -65.7 85.7-60.9 79.3-70.7 70.7 -79.3 60.9-85.7 65.7-93.5 54 -99.8 41.3-92.4 38.3-96.6 25.9 -99.1 13.1-107.1 14.1-108 0 -107.1-14.1-99.1-13.1-96.6-25.9 -92.4-38.3-99.8-41.3-93.5-54 -85.7-65.7-79.3-60.9-70.7-70.7 -60.9-79.3-65.7-85.7-54-93.5 -41.3-99.8-38.3-92.4-25.9-96.6 -13.1-99.1-14.1-107.1 0-108 14.1-107.1 13.1-99.1 25.9-96.6 38.3-92.4 41.3-99.8 54-93.5 65.7-85.7 60.9-79.3 70.7-70.7" style="fill:yellow;stroke:black; stroke-width:4"/>
</svg>
</div>

html
  • 3 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-04-04 14:58:08 +0000 UTC

徽标的旋转动画,同时保持字母的方向

  • 5

如何制作这个 SVG 形状的旋转动画?

  • 鼠标悬停时,图形需要旋转。
  • 字母的方向(倒置)在旋转过程中保持不变。

我们的任务不仅仅是做可行的事情,而是以一种好的、美丽的方式。有趣的不同解决方案,适用于任何技术:SMIL、JavaScript、CSS 等。其他

<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="190px" height="190px" viewBox="0 0 150 150" version="1.1">
  <g transform="translate(-27.970238,-63.089294)">
    <circle cx="102.97024" cy="138.08929" r="75" fill="#faa"/>
    <path d="m163.72735 175.21801-121.51422 0 60.75711-105.234398z" fill="#fea"/>
    <path d="m101.32534 136.51129c1.13707 1.96946-2.093801 2.50441-3.273369 1.88988-3.196557-1.66532-2.576443-6.16511-0.506394-8.43662 3.702833-4.0632 10.184423-2.9187 13.599873 0.8771 5.01231 5.57048 3.28688 14.26396-2.26058 18.76312-7.3939 5.99667-18.365634 3.66706-23.926377-3.64407-6.997627-9.20031-4.05364-22.47803 5.027556-29.08962 10.998541-8.00754 26.596501-4.44396 34.252881 6.41104 9.02277 12.79224 4.83662 30.71878-7.79454 39.41613-14.58316 10.04143-34.843578 5.23086-44.579374-9.17802-11.062431-16.37229-5.626194-38.97017 10.561506-49.74263 18.160148-12.085079 43.098048-6.022324 54.905878 11.94499 13.10894 19.94713 6.41905 47.2269-13.32848 60.06913" style="fill:none;stroke-width:0.26458332;stroke:#000"/>
    <g>
    <circle cx="55.940475" cy="108.0119" r="12.851191" fill="#efa"/>
    <text x="51" y="112" style="fill:#000;font-family:sans-serif;font-size:14px;font-weight:bold;letter-spacing:0px;font-height:2;">
        A
    </text>
    </g>
    <circle cx="153.68513" cy="110.27975" r="12.851191" fill="#efa"/>
    <text xml:space="preserve" x="114" y="116" style=fill:#000;font-family:sans-serif;font-size:14px;font-weight:bold;">
        B
    </text>
    <text xml:space="preserve" x="102.05357" y="195.70238" style="fill:#000;font-family:sans-serif;font-size:10.58333302px;letter-spacing:0px;line-height:1.25;word-spacing:0px">
C
</text>
    <g>
    <circle cx="105.15297" cy="192.45177" r="12.851191" fill="#efa"/>
    <text x="100" y="198" style="fill:#000;font-family:sans-serif;font-size:14px;font-weight:bold;letter-spacing:0px;line-height:1.25;word-spacing:0px">
        C
    </text>
    </g>
  </g>
</svg>

javascript
  • 3 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-02-18 22:33:05 +0000 UTC

如何制作一个旋转的 3D 球体?

  • 1

我想教球体绕 Y 轴旋转。
问题是如何做到这一点?

这是代码,它不能按我的需要工作:

Vue.config.devtools = false
Vue.config.productionTip = false

var app = new Vue({
  el: '#app'
})
.rotate {
  animation: rotate 5s infinite;
  transform-style: preserve-3d;
}

@keyframes rotate {
  to {
    transform: rotateY(360deg);
  }
}

.svg {
  transform-style: preserve-3d;
}

.circle {
  stroke: orangered;
  fill: rgba(0, 0, 0, 0);
}
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<div id="app">
  <svg width="178px" height="178px" version="1.1" viewBox="-100 -100 200 200" class="svg">
    <g class="rotate">
      <circle class="circle" v-for="x in 10" cx="0" cy="0" :r="95" :style="`transform: rotateY(${12*x}deg); transform-style: preserve-3d;`" />
    </g>
  </svg>
</div>

原来,磁盘正在旋转。我需要它是球体的旋转,就像地球绕着它的轴旋转一样。

我们设法找出了为什么这段代码不起作用,原因是,不管内部旋转如何,整个 SVG 绘图都是一个平面。

你如何解决这个问题并为整个球体的旋转设置动画?

在所有答案中,我希望获得针对不同技术的所有可能解决方案。
适用:HTML、CSS、SVG、SMIL、Canvas、WebGl、three.js 等。

PS:球体应该完全由示例中模型上的环组成,而不是任何球体。

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-02-14 15:53:16 +0000 UTC

带有卫星轨道的动画太阳

  • 16

我的任务是为太阳设置动画。
必须有闪光和小射线。光线应该像火焰一样燃烧并缓慢旋转。技术可以是任何东西:SVG、SMIL、JavaScript、CSS、Canvas、WebGl 或其他。

还需要使一颗行星围绕太阳旋转。这颗行星必须在这样的轨道上旋转,以使其在太阳后面的一部分飞行。

在此处输入图像描述

请告诉我如何做到这一点?

也接受部分解决方案的答案。例如:没有行星或没有射线。

总共应该有3个动画元素。

  1. 闪烁。
  2. 灯火如火。应该 a) 燃烧 b) 绕一圈旋转。
  3. 一个旋转的行星,其中一部分轨道跟随太阳。

PS:如果可以的话,我会尝试准备我的解决方案。

javascript
  • 7 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-01-14 21:48:33 +0000 UTC

如何检查通过 JavaScript 输入表单的 CSS 代码的有效性

  • 2

文本输入到表单CSS中,你需要在浏览器端检查它的有效性,或者扔掉所有无效的部分,只留下有效的部分。我怎样才能做到这一点?

#textarea {
  width: 100%;
  height: 120px;
}
<textarea id="textarea">.selector1 {
   color: red;
}
.selector2 div {
   font-weight: bold;
}
some_strange_code #^</textarea>
<button onclick="test()">Проверить</button>

对我来说更好的解决方案是不使用第三方库,但是使用第三方库的解决方案也是合适的,优先考虑库的轻便性,最好是一个你可以复制给自己的功能。

也许某种浏览器解决方案将输入css的内容连接到页面内部,浏览器可能会更正这个css内容,并丢弃它不理解的所有内容。该解决方案也适合我,主要是输出将是正常有效的css。
将输入添加css到页面中没有问题,但我仍然不明白如何提取它。
如果您将其添加到标签内,style它将以与您添加它相同的形式提取它而无需更正。可能有必要以不同的方式提取,而不是通过 dom。

javascript
  • 2 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-12-15 23:16:04 +0000 UTC

如何在多行列表中隐藏极端分隔符

  • 1

有一个元素列表,可以是多行的。例子:

.container {
  width: 440px;
  text-align: center;
}

.item {
  display: inline-block;
  background-color: #ffd473;
  border-radius: 4px;
  padding: 5px;
  margin: 3px;
  font-weight: bold;
}

.sep {
  margin: 0 10px;
}
<div class="container">
  <span class="item">MenuItem1</span>
  <span class="sep"> ❤️ </span>
  <span class="item">Item2</span>
  <span class="sep"> ❤️ </span>
  <span class="item">SomeText</span>
  <span class="sep"> ❤️ </span>
  <span class="item">Hi all</span>
  <span class="sep"> ❤️ </span>
  <span class="item">MenuItem5</span>
  <span class="sep"> ❤️ </span>
  <span class="item">MenuItem6</span>
  <span class="sep"> ❤️ </span>
  <span class="item">MenuItem very long text</span>
  <span class="sep"> ❤️ </span>
  <span class="item">More text</span>
  <span class="sep"> ❤️ </span>
  <span class="item">More else text</span>
  <span class="sep"> ❤️ </span>
  <span class="item">item10</span>
</div>

有必要隐藏sep极端的分隔符。我有 在此处输入图像描述

对任何 css 或 js 解决方案都满意。事先不知道菜单项的大小和数量。也就是说,该解决方案应该适用于任何菜单项和任何容器大小。

javascript
  • 4 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-05-22 16:06:53 +0000 UTC

锁和隔离级别

  • 2

我有这个统计模块代码:

using(TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {IsolationLevel = IsolationLevel.RepeatableRead})) 
{
     PersonDayStatisticsUnit pdsu = db.PersonDayStatisticsUnits.FirstOrDefault(x => x.UnitId == su.Id && x.Date == now && x.PersonAnonimousGuid == personGuid);
     if (pdsu == null) 
     {
         pdsu = new PersonDayStatisticsUnit() 
         {
             UnitId = su.Id,
                 Count = 1,
                 Date = now,
                 PersonAnonimousGuid = personGuid
         };
         db.PersonDayStatisticsUnits.Add(pdsu);
         ret = true;
     } 
     else 
     {
         pdsu.Count++;
         ret = false;
     }

     db.SaveChanges();

     scope.Complete();
 }

此代码在 ASP.NET MVC 5 上下文中工作。

发现此代码失败,出现无法使用重复键创建记录的错误。

错误是什么,我意识到显然两个线程进入了事务并试图创建同一个对象PersonDayStatisticsUnit,db.PersonDayStatisticsUnits.Add(pdsu).

也就是说,我错过了代码中的某些内容......

据我了解,所有这些代码都可以简单地放在 中lock,这应该可以解决问题。

这里有必要lock吗?解决这种情况的最佳方法是什么?事务如何与lock-s 关联,它们可以或应该同时完成,还是只需要在这里进行不同类型的事务IsolationLevel?

c#
  • 2 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-04-09 02:38:28 +0000 UTC

用 HTML 制作复活节彩蛋

  • 7

任务是使用任何 WEB 技术制作复活节彩蛋。

HTML、CSS、SVG、Canvas、JavaScript,你可以使用任何技术和技巧。

javascript
  • 3 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-04-07 22:13:12 +0000 UTC

如何在 C# 中将 SVG 转换为 JPG 或 PNG?

  • 4

我在 C# 中生成 SVG 文件,我需要使用 C# 将它们呈现为 JPG 或 PNG。我怎样才能做到这一点?

任何选项都很有趣,但我只接受适用于共享主机的答案,因为脚本将在那里运行。ASP.NET MVC 5 托管 - Smarterasp。

c#
  • 3 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-04-06 18:43:36 +0000 UTC

transform 中变换序列的逻辑

  • 5

我不完全理解 SVG 中的转换是如何工作的。

<svg style="width:400px; height: 400px;" viewBox="-100 -100 400 400" xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink">
    <line x1="-200" y1="0" x2="400" y2="0" stroke="lime" stroke-dasharray="5 5"></line>
    <line x1="0" y1="-200" x2="0" y2="400" stroke="lime" stroke-dasharray="5 5"></line>
    
    <rect x="20" y="20" width="40" height="40" fill="aqua" ></rect>
    <rect x="20" y="20" width="40" height="40" fill="green" transform="scale(2, 2)"></rect>
</svg>

为什么scale他们不是围绕图形的中心,而是从原点开始,因为现在图形不仅增加了,而且还移动了……那么问题是如何围绕中心增加它?

<svg style="width:400px; height: 400px;" viewBox="-100 -100 400 400" xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink">
    <line x1="-200" y1="0" x2="400" y2="0" stroke="lime" stroke-dasharray="5 5"></line>
    <line x1="0" y1="-200" x2="0" y2="400" stroke="lime" stroke-dasharray="5 5"></line>  
    
    <rect x="20" y="20" width="40" height="40" fill="green" transform="translate(-20,-20) scale(2, 2)"></rect>
    <rect x="20" y="20" width="40" height="40" fill="aqua" ></rect>
</svg>

在这种情况下,我translate(-20,-20)用第一个动作将图形返回到原点,正如我所想的那样,当缩放时,图形应该保持在坐标处0,0,但它仍然保持移动,为什么?

<svg style="width:400px; height: 400px;" viewBox="-100 -100 400 400" xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink">
    <line x1="-200" y1="0" x2="400" y2="0" stroke="lime" stroke-dasharray="5 5"></line>
    <line x1="0" y1="-200" x2="0" y2="400" stroke="lime" stroke-dasharray="5 5"></line>
    
    <rect x="20" y="20" width="40" height="40" fill="green" transform="translate(-20,-20) scale(2, 2)"></rect>
    <rect x="20" y="20" width="40" height="40" fill="red" transform="scale(2, 2) translate(-20,-20)"></rect>
</svg>

这两个选项有什么区别?我是否正确理解转换是从最后执行的?

如何正确地将形状旋转 45 度并将其相对于其中心的大小加倍?

<rect x="30" y="30" width="40" height="40" fill="blue"></rect>
svg
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-03-29 17:31:48 +0000 UTC

将文本转换为路径

  • 5

我有SVG一个文本文件

<svg width="430" height="133" style="background: pink">
   <text x="20" y="100" font-size="100" fill="blue">ПРИВЕТ</text>
</svg>

我需要将文本转换为path,以便每个字母都成为路径,我该怎么做?

JavaScript、编辑器、在线服务 - 任何解决方案都适用,因为操作是一次性的。

svg
  • 3 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-03-21 22:37:03 +0000 UTC

从正方形制作动画 SVG 背景

  • 5

有必要编写一个脚本,以随机旋转创建相似颜色的正方形背景。

背景动画,当鼠标移动时,鼠标悬停的方块变成指定的颜色,这个颜色逐渐变成方块的原色,也是随机旋转动画。

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-03-19 01:04:29 +0000 UTC

如何将现有的 SVG 形状转换为不同的坐标

  • 10

我有一个从 SVG 编辑器获得的 SVG 形状。

如何将其转换为所需尺寸原点的坐标?

现在,为了将其放置在某处,您必须添加 to path transform="scale(...) translate(...)",并且您必须手动选择移位和缩放值。总的来说,scale translate毕竟其他尺寸开始起作用。

如何正常使用这些形状并将它们放置在画布上?

我想要什么:一些实用程序或功能,将坐标和大小path-a 重新制作为原点和所需的大小。

<svg style="width:400px; height:400px; background-color:pink">
  <path d="m53 297c0 0-1 0-1 0 0 0 0-3 0-7 0-6 0-10 1-12 0-1 1-1 2-1 1 0 2 1 3 2 0 1 0 5 0 9 0 2 0 4 0 5 0 2-1 3-2 4-1 1-1 1-3 0zm-24-5c-1 0-1-1-1-1 0-1 1-4 4-10 2-3 2-5 3-6 2-2 2-2 4 0 1 1 1 1 1 2 0 2-1 5-3 8-2 3-3 4-3 5 0 1-1 2-2 3-1 1-1 1-3 0zm46-3c-3-3-9-13-9-15 0-1 1-2 1-3 0 0 1 0 2-1 2 0 2 0 2 0 2 1 5 7 8 14l1 3-1 1c-1 1-3 2-3 2 0 0-1-1-2-1zm-65-16c-1 0-1-2-1-3 0-1 7-6 10-7 2-1 3-1 4-1 1 0 1 1 1 2 0 1 0 2 0 2 0 1-3 2-6 4-1 0-2 1-3 2-2 1-4 1-5 1zm86-2c-1 0-2 0-6-3-2-1-4-2-6-3-2-1-3-2-4-3-1-1-2-2-2-3 0-1 0-2 2-2 1 0 4 0 6 1 2 1 9 6 11 7 1 1 2 2 1 4-1 2-1 2-3 1zm-56-1c-2 0-5-1-6-2-3-2-5-5-7-8-3-5-4-14-2-19 2-7 9-15 15-19 2-1 5-2 6-2 1 0 1 0 1 1 1 1 1 4 0 5 0 1-1 2-4 5-7 6-8 9-9 14 0 2-1 4-1 5 0 2 1 6 3 8 5 7 13 8 24 2 3-2 5-4 9-10l2-3 0-3c0-3 0-4-1-5-1-2-3-3-5-4-1-1-2-1-4-1-2 0-3 0-5 1-3 1-6 3-7 6 0 1-1 1 0 3 0 2 1 4 2 5 1 1 1 1 2 1 1 0 1 0 1 0 0 0 0-1-1-1-2-2-2-4-1-6 1-1 4-3 5-3 2 0 3 1 5 3 2 3 3 5 1 9-1 3-5 6-8 7-2 1-6 0-8 0-1 0-2-1-2-1-1 0-3-5-3-7-1-4 0-10 2-13 2-2 5-5 9-7 4-2 5-3 9-3 4 0 6 1 9 3 5 4 7 9 7 16 0 4 0 8-1 10-1 2-2 4-6 7-6 5-12 7-21 9-3 0-8 0-11 0zM5 248c-4 0-4-1-5-2-1-1-1-2 0-2 1-2 4-2 12-2 6 0 6 0 7 1 1 0 1 1 2 2 1 2 1 2-2 3-3 1-8 2-14 1zm80-1c-1-1-1-1-1-2 0-2 1-3 6-4 1 0 3-1 4-1 1 0 3-1 6-1 4 0 4 0 5 0 1 1 1 2 1 3-1 1-1 2-5 3-5 1-9 2-12 2-3 0-3 0-4 0zM19 230c-9-5-14-8-14-10 0-1 0-2 1-3 1 0 1 0 3 0 2 1 7 3 9 4 1 1 3 2 4 3 3 2 3 3 2 5-1 1-2 2-3 2 0 0-1-1-3-1zm58-2c-1 0-2-2-2-2 0-1 0-1 2-3 3-3 6-5 8-7 1-1 2-1 3-1 2 0 4 2 3 4-1 1-3 3-5 5-5 3-7 4-8 4zm-46-10c-2-2-4-5-5-9-1-3-1-3-1-5 0-3 0-4 2-4 1 0 2 1 2 1 0 0 1 2 3 5 3 5 4 7 4 10 0 2 0 2-2 3-1 0-1 0-2-1zm25 0c-1-1-2-2-2-3 0-1 1-10 1-12 1-3 2-5 4-6 1 0 2 0 2 2 1 2 1 7-2 18 0 0-1 1-1 1-2 1-1 1-2 0z" id="path826" style="fill:green;"/>
</svg>

滚动浏览下面的示例以查看该图。

我需要像这样将这个形状放在画布上:

在此处输入图像描述

如何正确完成?

svg
  • 5 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-03-18 18:16:53 +0000 UTC

为什么渐变到透明的渐变会产生黑色?

  • 5

有两个渐变圆,一个我过渡到透明颜色transparent,另一个过渡到与背景相同的颜色pink。

我原以为结果会一样,但结果不一样,而且,如果你仔细观察,当你切换到透明色时,会观察到黑色。这是为什么?

我需要什么。

我想生成一个渐变的彩色圆点背景。

但如果我过渡到transparent那里,就会有很多黑暗,这不适合我。而且我不能选择渐变去的固定颜色,因为斑点是随机产生的,在固定的极端颜色的情况下,它们会相互重叠,这可以在第二块中看到例如,但我需要它们发光。在第一个街区,它们发光,但那里出现了黑暗。

如何做到这一点,有可能吗?

<svg style="background-color: pink; width:500px; height:350px;">
  <g>
    <radialGradient id="grad1">
                <stop offset="0%" stop-color="white"></stop>
                <stop offset="15%" stop-color="blue"></stop>
                <stop offset="40%" stop-color="blue"></stop>
                <stop offset="100%" stop-color="transparent"></stop>
            </radialGradient>
    <circle cx="110" cy="110" r="100" fill="url(#grad1)"></circle>
  </g>
  <g>
    <radialGradient id="grad2">
                <stop offset="0%" stop-color="white"></stop>
                <stop offset="15%" stop-color="green"></stop>
                <stop offset="40%" stop-color="green"></stop>
                <stop offset="100%" stop-color="transparent"></stop>
            </radialGradient>
    <circle cx="140" cy="220" r="100" fill="url(#grad2)"></circle>
  </g>
  <g>
    <radialGradient id="grad3">
                <stop offset="0%" stop-color="white"></stop>
                <stop offset="15%" stop-color="blue"></stop>
                <stop offset="40%" stop-color="blue"></stop>
                <stop offset="100%" stop-color="pink"></stop>
            </radialGradient>
    <circle cx="350" cy="110" r="100" fill="url(#grad3)"></circle>
  </g>
  <g>
    <radialGradient id="grad4">
                <stop offset="0%" stop-color="white"></stop>
                <stop offset="15%" stop-color="green"></stop>
                <stop offset="40%" stop-color="green"></stop>
                <stop offset="100%" stop-color="pink"></stop>
            </radialGradient>
    <circle cx="380" cy="220" r="100" fill="url(#grad4)"></circle>
  </g>
</svg>

css
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-03-18 17:57:40 +0000 UTC

为什么不能通过 JavaScript 向 SVG 添加元素?

  • 6

有一个脚本,它给SVG添加了一个圆圈,这个圆圈是添加到HTML标记本身的,你可以通过调试器查看,但是我的浏览器中没有显示这个圆圈。也就是说,HTML 已更新,但未绘制添加的元素。

同时,生成的 SVG 本身是有效的,您可以通过从调试器中复制来检查这一点。更简单的是,你可以直接在调试器中检查,点击编辑HTML并在SVG前加一个空格,例如,保存,圆圈立即出现。

为什么会这样以及如何解决?

var svg = document.getElementById("svg1");

var circle = document.createElement("circle");

circle.setAttribute("cx", 110);
circle.setAttribute("cy", 20);
circle.setAttribute("r", 50);
circle.setAttribute("fill", "green");

svg.appendChild(circle);
<svg id="svg1" style="width:400px; height:150px; background-color: pink;">
  <rect x="20" y="20" width="100" height="60" fill="blue" />
</svg>

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-03-09 23:41:35 +0000 UTC

如何使用 JavaScript 为 div 制作 SVG 背景

  • 3

有div。

<div id="myDiv1">...</div>

有一个生成 SVG 的 JavaScript 函数。

function GenerateSVG() {
   ...
   return SVGtext;
}

我需要在这个背景下编写生成的 SVG 代码div。

我怎样才能做到这一点?

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-02-06 22:37:14 +0000 UTC

如何在word文档中插入字体?

  • 3

我在网上找到了一种字体,我想在 Word 文档中编写文本时使用它。我可以将此字体添加到 Windows。但是,如果我将此文档发送给没有安装此字体的其他人,会发生什么?

需要什么:让收到此文档的人以正确的形式看到文本,而无需在 Windows 中额外安装字体。

可能吗?如果是这样,怎么做?

шрифты
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-02-06 03:31:44 +0000 UTC

如何在本地服务器上腾出时间?

  • 0

以前,我会在我所在的时区的莫斯科主持,并且该网站按预期运行。现在我们正在转移到一个新的主机(SmarterAsp,Shared),它的时间已经改变了几个小时。

是否可以以某种方式配置 DateTime.Now 以返回莫斯科时间,还是我需要重写代码?

如果我重写,那么我认为我将在DateTime.Now->上进行替换DateTime.LocalNow,LocalNow我的扩展将在哪里。那么如何更好地组织这个功能的工作呢?

这是我的代码,请检查它是否有效

var tz = TimeZoneInfo.FindSystemTimeZoneById("Moscow Standard Time");
TimeZoneInfo.ConvertTime(DateTime.Now, tz);

为了加速tz,我将取出一个静态常数。

我是否正确理解是什么TimeZoneInfo.ConvertTime将当地时间带到任何时区?为什么是问题。因为我不清楚这个函数是从哪个区域工作的,因为在转换区域时,您需要知道区域 A(从哪里转换)和 B(从哪里转换),然后进行计算。而且我不太明白如何在不知道 A 的情况下执行此操作,或者 A 是服务器的时区?

网站通常如何绑定时区?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-01-24 22:32:47 +0000 UTC

为什么路由器链接元素不呈现?

  • 1

我有一个文件app.vue

<template>
    <h1>Hello App!</h1>
    <p>
        <router-link to="/foo">Go to Foo</router-link>
        <router-link to="/bar">Go to Bar</router-link>
    </p>
    <router-view></router-view>
</template>

<script>
    import VueRouter from "vue-router";

    export default {
        name: 'app'
    }
</script>

和可执行文件main.js

import Vue from 'vue'
import App from './App.vue'
import VueRouter from "vue-router";

Vue.use(VueRouter);

const Foo = {template: '<div>foo</div>'}
const Bar = {template: '<div>bar</div>'}

const routes = [

    {path: '/foo', component: Foo},
    {path: '/bar', component: Bar}
]

const router = new VueRouter({
    routes // сокращение от `routes: routes`
})

const app = new Vue({
    router,
    render: h => h(App)
}).$mount('#app')

呈现应用程序,没有显示错误,但router-link没有链接。我不知道出了什么问题。

对于我使用的汇编rollup,我不知道这是否重要。

我是Vue.js新手,我想了解如何使用.vue文件、路由和基本模板制作项目。

通过添加决定div

<template>
    <div> /* добавил */
        <h1>Hello App!</h1>
        <p>
            <!-- используйте компонент router-link для создания ссылок -->
            <!-- входной параметр `to` определяет путь для перехода -->
            <!-- `<router-link>` по умолчанию преобразуется в тег `<a>` -->
            <router-link to="/foo">Go to Foo</router-link>
            <router-link to="/bar">Go to Bar</router-link>
        </p>
        <!-- отображение компонента, для которого совпал путь -->
        <router-view/>
    </div>
</template>

但是为什么div需要这个,我不明白?

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий Полянин
Asked: 2020-01-23 17:30:03 +0000 UTC

为什么 input.value 第二次不改变

  • 3

我进行输入,输入数据,它立即将它们替换为“11.11”,这对我来说应该是这样的。但是如果在这个替换之后我继续输入数据,它就会停止替换它们,我不明白这个。

我有它 v-bind:value="val",理论上,如果我覆盖this.val它,它应该在输入中显示它。它会改变自己val,我推断它,但不是在输入中。

Vue.component('currency-input', {
  template: `<span>
      <input
        v-bind:value="val"
        v-on:input="updateValue($event.target.value)"> val: {{val}}
    </span>`,
  data: function() {
    return {
      val: ""
    };
  },
  methods: {
    updateValue: function(value) {
      this.val = "11.11";
    }
  }
});

// создание корневого экземпляра
var app = new Vue({
  el: '#app',
  template: `<div>
                    <currency-input></currency-input>
                    </div>`,

})
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.13/dist/vue.js"></script>
<div id="app">

</div>

javascript
  • 2 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5