Questions tagged [svg]
Scalable Vector Graphics (SVG) is a family of specifications of an XML-based file format for two-dimensional vector graphics, both static and dynamic.
55 questions
0
votes
0
answers
20
views
4
votes
1
answer
113
views
Shorten a SVG file created with Inkscape
I often use Inkscape for generating SVG images. However, these images contain data which doesn't seem to affect the visual output, so I want to remove it. To do that, I wrote the following code:
...
2
votes
1
answer
35
views
SVG hue navigation bar
I've created a navigation spacer bar that has a hue background. To separate different aspects of content it was imported to Inkscape then exported as an SVG. It uses base64 image which I’m not sure is ...
1
vote
1
answer
93
views
PacMan in JavaScript and SVG
So, I happen to know a bit about front-end development, and I'll make a seminar at the university about it where I share that knowledge with my fellow students. A few years ago, I've made a PacMan in ...
3
votes
1
answer
135
views
Small Javascript Lib to draw SVG file
I'm new to JavaScript and I decided to make a script that allows other developers to show SVG elements in the web browser. (It is just for learning purposes), and it is still under development.
I ...
3
votes
0
answers
59
views
Browser-editable SVG diagrams using JS & SVG.js
[This is my first question to Code Review and it might be a bit too much.]
I want to give users the means to draw a simple diagram in the browser, and because it is partly a self-education project ...
2
votes
1
answer
1k
views
d3.js canvas performance
I've just rewritten this code (a simple gravitational restricted n-body simulation) to display using canvas, rather than SVG. The reason being that I'd like to be able to run it with many thousands of ...
10
votes
1
answer
232
views
Visualization of the Pythagorean theorem
Background
The Pythagorean theorem asserts that for a right triangle with hypotenuse \$c\$ and other sides \$a\$ and \$b\$, the area of the square placed upon \$c\$ is equal to the sum of the areas ...
2
votes
0
answers
1k
views
Grouped stacked bar chart in d3js
I've the following d3 chart which is both grouped and each grouped contains a stacked bar. But somehow, I feel this is not a proper way to implement and little complicated. If there was only stacked ...
4
votes
1
answer
230
views
Shell function to convert .png to .svg file
I needed to convert some custom icons that were in .png format to .svg format and did not want to use an online converter for it.
I could not find an out-of-the-box solution online so I created my ...
11
votes
3
answers
3k
views
Draw sine wave going around a circle
I have used d3 to draw a sine wave going around a circle. This is the very first time I've used d3 or drawn a SVG and I'm fairly new to JS as well, so I don't know if I've overcomplicated it/if there ...
2
votes
1
answer
156
views
Simplify SVG creation and manipulation using Proxy
A need
I have always found dynamically creating SVG content and filters a painful and messy process.
The constant need for conversion from JavaScript values to SVG and back,
Access to the SVG ...
6
votes
2
answers
539
views
Soccer field map creator
I am fairly new to OOP and am working on a little website project to practice. I wanted to post after getting the initial setup done in case I am making any major errors or not following best ...
0
votes
1
answer
74
views
Simple chart class for SVG path generation
Here is a class I have:
...
4
votes
1
answer
44
views
Compare timestamps of svgs versus exported pngs and export via Inkscape
This script goes through all svg files in an assets folder and compares them to the exported layers (one level above). If the svg timestamp is newer, it will automatically export the svg using ...
7
votes
1
answer
188
views
Random Dice Simulation
I extended the example in 04-random.elm to support N dice and to draw the results using SVG.
...
3
votes
1
answer
2k
views
Compress svg files in PHP
I wrote something to "compress" svg files. The svg files I am using often have comments and empty <g> tags, and I want to remove them. My main goal is not the ...
7
votes
1
answer
1k
views
Python fractal tree using SVG
I made a simple program to generate fractal tree using PATH object of SVG. Any suggestions?
...
7
votes
1
answer
266
views
Loading an SVG into the canvas
The code below is loading an svg into the canvas via RaphaelJS. There are mouseover/mouseout events, on click on an element of the svg, and drag/zoom.
I would like to know, what are some good ...
1
vote
1
answer
2k
views
"Spinning wheels" - Animated spinner with SVG and Sass-CSS
I've made this little animation using SVG, CSS-keyframes and a bit of Sass.
...
3
votes
0
answers
730
views
JSON schema visualizer
I have the following backbone function to read a JSON schema and draw the tree structure (as in the screenshot below). I want to make sure if checking against the type as object/array is alright or if ...
5
votes
1
answer
7k
views
Using d3.drag() to enable dragging on an SVG group
I'm using the following function to enable dragging on an SVG group.
...
2
votes
0
answers
497
views
SVG filtering an image to stepped alpha grayscale
I have a variety of images that will be used in a style intended to mimic a dot-matrix LCD.
In a previous version, I rendered these images using a program and essentially ended up with a duplicate of ...
4
votes
1
answer
2k
views
SVG photo mosaic creator
I got this as part of some interview assignment. After some head scratching I think I have done quite well as the result can be seen here:
After transformation(10x10 tile):
More crisp picture with ...
4
votes
1
answer
528
views
Plotting discontinous function
I've made a simple web plot with D3 JS version 4. I've drawn a discontinuous function:
$$f(x)=\frac{1}{x(x-2)}$$
which has 2 vertical asymptotes and 1 horizontal asymptote. I add a legend with LateX:...
4
votes
1
answer
164
views
Render SVG background with Gradient
I'm new to and still fairly confounded by SVGs. I'm feeling pretty happy with the following hobbled together SCSS code demonstrated here:
...
7
votes
1
answer
2k
views
2D colliding disks in JavaScript (ideal billiard balls)
I am implementing a simulation of colliding disks (ideal 2D billiard balls) in JavaScript.
I follow an event-driven algorithm that avoids discretizing time; the algorithm goes as follows at each step:...
1
vote
1
answer
4k
views
Converting an SVG polygon path from relative to absolute coordinates
This question was moved from StackOverflow as suggested by some users.
I developed a function that aims to (should) provide a simple and effective method to transform a polygon ...
10
votes
2
answers
135
views
Git Insert Delete Graph
I attempted to recreate the GitHub code frequency graph (example) with a daily granularity using Perl and git log. How did I do, and what improvements can I make? I ...
3
votes
0
answers
382
views
Hourglass path in SVG for Android
I've created my first Android drawable, a hourglass shaped image, and I'm curious what can be improved with it. It seems weird having to use 4 paths, but I couldn't get it to work any other way.
...
4
votes
1
answer
217
views
Cutting rectangle from circle
Can the following code snippet be optimized or am I doing it right?
...
97
votes
3
answers
6k
views
Shielding your CodeReview on GitHub
In response to a feature-request on meta, I spent a few hours today creating the feature in php.
This application adds a review shield to your GitHub repository (or wherever else you want it).
It ...
6
votes
1
answer
4k
views
Simple grid using SVG
I developed this grid which displays number of records for X & Y, user can click each number to see a list. (I didn't add list markup to fiddle yet - so lets not worried about it for now.)
What I ...
4
votes
1
answer
3k
views
D3.js interpolating line on circumference of circle
For now, I've tried to make a line rotate on the path of a circle, but used setInterval multiple times and there might be other ways of achieving the same.
I would ...
5
votes
1
answer
4k
views
CSS mask clipping and overlay SVG to achieve a two effect
I am currently attempting to create a two SVG overlay / masking like the image below:
I have created a SVG for the overlay. As it stands, I am trying to create two elements one for the green side and ...
0
votes
1
answer
762
views
Colour-changing clock
I am fairly new to javascript and I would like to write my code on a more readable and efficient way. Any critique of what I've written would be greatly appreciated, especially the section of ...
3
votes
1
answer
1k
views
Generating SVG animation of falling leaves
This is a Python script I wrote to generate a SVG animation of falling leaves.
How can I simplify my script and also make the animation look more realistic?
...
6
votes
2
answers
1k
views
Parse floats from a string
While fixing some old code I came up with a class that parses floats from a string.
This is used for parsing svg files in xml format. Floats can be separated by comma, space or anything at all in ...
2
votes
1
answer
138
views
SVG drawing code
How could I optimize this code / make it look better? Any advice on things I'm doing wrong?
...
1
vote
1
answer
1k
views
Is the Button, an <a> element with svg code and hidden link content inside, ARIA conform and well laid out?
I have an a element for a button. The SVG snippet inside links to the containing SVG file at the top of the body.
...
2
votes
1
answer
874
views
Google Map, SVG Graph and ruler
I would like to get feedback on the code. It is working and can be seen here.
I welcome any kind of feedback, since I am just starting to use JavaScript. Epecially in the case of performance, there ...
2
votes
0
answers
2k
views
Optimizing snap SVG animation with collision detection
I have a snap SVG animation which animates a bunch of circles, and draws a line between them if they are within a certain proximity of each other. However, I realize that there is a lot of optimizing ...
8
votes
1
answer
25k
views
HTML / JS Slot Machine Simulator
This code is a slot machine simulator that uses elements of both HTML and JavaScript. Please pardon the lack of comments.
...
-1
votes
1
answer
357
views
Optimizing this SVG animation for size [closed]
I'd like to code review generated svg animation, while this might stretch definition of this site, I really hope this is interesting and revelant topic, as this SVG file is really like any other ...
6
votes
2
answers
871
views
Python Barcode Generator v2
This is a complete rewrite of the code posted for review in this question. The question is identical.
...
12
votes
1
answer
27k
views
Making lines with SVG and JavaScript
I just started trying out SVG the other day. Eventually I hope to be able to know how to do what SE does with their reputation graphs.
For now, I've just been trying to set up an easier way to make ...
3
votes
1
answer
2k
views
Displaying overlapping blocks using d3.js
The code takes in nodes with different start time as input and assigns the position such that they will not overlap. As I have coded with too many loops and conditions. Can anyone review the code and ...
0
votes
1
answer
208
views
Perl Hash mapping SVG elements to their attributes
Is there a more reliable way of building a hash of the attributes associated with each SVG element?
...
0
votes
1
answer
167
views
Perl hash mapping SVG elements to content elements
Is there a more reliable way of getting the content elements for each SVG element?
...
6
votes
2
answers
6k
views
SVG path parsing
I have a module in Python for dealing with SVG paths. One of the problems with this is that the SVG spec is obsessed with saving characters to a pointless extent. As such, this path is valid:
...