SVG Editor with variables - Forum

Forum Navigation
You need to log in to create posts and topics.

SVG Editor with variables

Hello and happy new year,

I am trying to make a SVG Editor with preview. In my editor I use some variables that user use and change the polygon.

In normal way when I put the variable to the text editor I have a good result. Put my big problem is when I need to make some maths. So maybe I need [X]/5 or [Y]*2. Is that possible? Is someone have a solution?

Please check my demo and load the svg.

Uploaded files:
  • You need to login to have access to uploads.

@sakismor you can use this syntax:

[X/5] or [Y*2]

This will perform the operation directly.

Regards.

sakismor has reacted to this post.
sakismor

I am really thank you. I don't think so that was too easy.

The only problem is with [x+10] I am not getting the right number.

What is the problem?

@sakismor please be sure your [x] variable stores a number and not a string.

If your [x] variable stores "5" then [x+10] will be "510"
If your [x] variable stores 5 then [x+10] will be 15

Regards.

I am really thank you.