I’m not really sure how to explain this, but I’ll give it a shot.
I have a URL that has a SVG file on it, and want to load it in and display it in my project.
Something like:
PShape costume;
costume = loadShape("https://assets.scratch.mit.edu/internalapi/asset/638caba865e74c287e8424d3cc1230ad.svg/get");
The issue is that the URL has the SVG file in the format of a HTML document, and I don’t know If its possible to load it in or not. Is there any way to do this?
EDIT: I think it’s actually XML, not 100% sure what that is…
1 Like
kll
January 15, 2019, 7:09am
2
looks for me like a good SVG
should not be a problem
but it says here ( RPI / Raspbian / Processing 3.4 / JAVA mode )
using the
/example/basics/shape/loaddsiplaySVG/
Unsupported format: https://assets.scratch.mit.edu/internalapi/asset/638caba865e74c287e8424d3cc1230ad.svg/get
here looks better
A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners.
but saving the content to a local svg file OK
PShape bot;
void setup() {
size(500, 500);
// bot = loadShape("https://assets.scratch.mit.edu/internalapi/asset/638caba865e74c287e8424d3cc1230ad.svg/get");
bot = loadShape("data/mitsvg.svg");
}
void draw() {
shape(bot, 0, 0);
}
2 Likes
Thank you so much! I’ll be sure to try that.
I was looking at your code, and wondered if there was anyway that the file could be downloaded and saved to the computer all in the project instead of being done manually before hand.
kll
January 15, 2019, 1:39pm
5
?? that question i not understand
but i did a test and uploaded it to my blog and loaded it from there
bot = loadShape("http://kll.engineering-news.org/kllfusion01/downloads/mitsvg.svg");
and it works,
( but i can not be your file server… )
so i think there might be a problem about the
/get