svg

Animate calligraphy using image-file instead of SVG

让人想犯罪 __ 提交于 2021-01-29 17:36:02
问题 I am creating animated calligraphy using the stroke-dashoffset technique, applying the stroke as an animated mask on top of an SVG. This works on most browsers, but I would like to apply the same mask on top of a PNG instead. That way, even if the browser has trouble with both SVG and mask (IE...), at least it will just display the PNG as-is. Here is a codepen of the working calligraphy with pure SVG: https://codepen.io/benviatte/pen/PMzmYB Here is the codepen of the non-working calligraphy

Using transitions in React Hooks and D3

一个人想着一个人 提交于 2021-01-29 17:22:37
问题 I am trying to replicate the gauge seen here in React with Hooks. It's the first time I am working with D3.js and even though I managed to replicate the gauge itself, the behavior is a bit strange (transition of the needles does not work) and I am not fully understanding the dynamics between useEffect and D3. Basically I want to add two needles that will each receive different values and use a transition when their value changes. //declaring angle value const [angle1, setAngle1] = useState(0)

Using Tensorflow / Keras: Image manipulation inside tf.py_function

為{幸葍}努か 提交于 2021-01-29 16:43:37
问题 I'm using Tensorflow 2.0 / Keras to generate building footprints for a procedural city. I would like to feed in a source image representing a city 'block', and have the network return the predicted building foundations. Input / Output I've had some success using a pix2pix-like GAN architecture, but the output would ideally be a vector image rather than a bitmap. I've therefore been trying to implement a different model, where the input image is convolved down to a 32x32 tensor, converted to a

Drawing connective elements between fixed positions on several html elements

有些话、适合烂在心里 提交于 2021-01-29 15:20:12
问题 I am quite new to web programming, so please bear with me if I am missing something obvious. I am using html, css and javascript to visualize different DNA sequences. Each sequence is represented as a graph of html elements and has a fixed length corresponding to the length of the DNA sequence. Spans are positioned at fixed points in each graph to represent certain motifs. The code for one such graph looks like this (using django as my web framework): <div class="graph" style='--graph-length:

An element situated over a svg is not clickable

心不动则不痛 提交于 2021-01-29 14:17:18
问题 There is svg containing more elements, one of them being a drop-down selector. The problem I encounter is that the selector can be clicked only on the top edge of it but not anywhere else on the selector. The selector is called yp-date-range-selector . In the next image it can be seen the only part of it which is clickable (the top edge). the css of yp-date-range-selector is : .yp-date-range-selector{ height: 29px; margin-top: 0px; font-size: 12px; } If I go upper it looks like: .rtm-alerts {

How do I create a distance scale ring in SVG in openlayers 3?

♀尐吖头ヾ 提交于 2021-01-29 12:54:56
问题 I want to draw an SVG distance ring on one of the layers in openlayers 3, centered around the center of the screen.Draw each ring in screen coordinates. The distance between each ring represents the distance on the map. The distance between each ring varies as the map scales. 回答1: It's probably best done using OpenLayers own styling capabilites. For example, adding a dummy layer with feature covering the whole extent which can be styled as rings around the map center. Note that depending on

Processing order of mask and filter in SVG

纵然是瞬间 提交于 2021-01-29 12:52:14
问题 The SVG below contains a rectangle with a blur filter and a circular mask applied. The result is a red circle, so obviously the filter is applied before the mask. This seems to be the same on all browsers. <svg width="300" height="300"> <defs> <filter id="f1"> <feGaussianBlur stdDeviation="10" /> </filter> <mask id="m1"> <circle cx="150" cy="150" r="50" fill="#fff"/> </mask> </defs> <rect x="50" y="50" width="200" height="200" fill="red" mask="url(#m1)" filter="url(#f1)"/> </svg> My question

Parse SVG file to React component

大兔子大兔子 提交于 2021-01-29 12:39:12
问题 I have an SVG file: check.svg <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28.3 28.3"><path d="M25.2 3.638l-1.6 1.6c-4.3 4.3-8.9 9.2-13.2 13.6l-5.9-4.9-1.7-1.4-2.8 3.3 1.7 1.4 7.5 6.2 1.6 1.3 1.4-1.4c4.8-4.8 9.9-10.4 14.6-15l1.6-1.6-3.2-3.1z"/></svg> I want a React component from it; but I don't want any wrapper tag, just <svg> <path […]/> </svg> I know I can do something like const renderSvg = svg => React.createElement('svg', { dangerouslySetInnerHTML: { __html: svg } }); or even

How to display plot images in Rmarkdown through a for loop?

依然范特西╮ 提交于 2021-01-29 09:44:03
问题 I am handling a list of svg to print to a html document. I am using the magick package thought I am open to using other packages/solutions. The below code is my attempt to render my html document. However, instead of rendering the svg to the html file, it simply prints the metadeta into the document. Is there a way to overcome this behavior? --- title: "My Test Report" author: "Nicholas Hayden" date: "6/12/2018" output: html_document --- ```{r setup, set-options, include=FALSE, warning=FALSE}

react - Images in public return 404 since added proxy

白昼怎懂夜的黑 提交于 2021-01-29 09:21:11
问题 I set my images inside the public/avatars and render them via <img src='avatars/my-image1.svg' /> my app run on : http://localhost:3001 it works fine, but since I added a proxy inside the package.json: proxy: http://localhost:3000 the images return 404 (not found) Does anyone have any idea how to fix it? 回答1: The solution was to set the proxy for the endpoint via src/setupProxy.js (not via package.json) and place the following contents in it: const { createProxyMiddleware } = require('http