Giter Club home page Giter Club logo

svg2p5's Introduction

Welcome to My GitHub
have fun & try not to break anything

svg2p5's People

Contributors

ygev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

svg2p5's Issues

An error occurred when the script translating coordinates.

Actually Transformations such as translate(), rotate(), and scale() do not work within beginShape(). It is also not possible to use other shapes, such as ellipse() or rect() within beginShape(). (See reference)

For example, the script dosen't work well with the svg markup below:

<svg fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
  <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15a4.5 4.5 0 ,0,0,4.5 4.5H18a3.75 3.75 0 0,0,1.332-7.257 3 3 0 ,0,0,-3.758-3.848 5.25 5.25 0 0,0,-10.233 2.33A4.502 4.502 0 0,0,2.25 15z"></path>
</svg>

...as it outputs the following p5.js code using translate() within beginShape():

strokeCap(ROUND);
strokeJoin(ROUND);
beginShape();
vertex(2.25,15);
translate(6.75,15);
rotate(0);
arc(0,0,4.5,3.141592653589793,1.5707963267948966,1);
rotate(0);
translate(-6.75,-15);
vertex(18,19.5);
translate(18.004055868688575,15.750002193343418);
rotate(0);
arc(0,0,3.75,1.5718778919893823,-1.2088250759817043,1);
rotate(0);
translate(-18.004055868688575,-15.750002193343418);
translate(16.501840726401678,11.2479128248915);
rotate(0);
arc(0,0,3,0.3381004956888263,-1.8852323996796212,1);
rotate(0);
translate(-16.501840726401678,-11.2479128248915);
translate(10.49377898204332,9.719331683797977);
rotate(0);
arc(0,0,5.25,-0.25500852097167903,-3.3343397810501907,1);
rotate(0);
translate(-10.49377898204332,-9.719331683797977);
translate(6.751999996770499,15.000170523980728);
rotate(0);
arc(0,0,4.502,-1.889584750326278,-3.1415547762062372,1);
rotate(0);
translate(-6.751999996770499,-15.000170523980728);
endShape();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.