JRD91
JRD91

Reputation: 139

Altering SVG shapes using JavaScript

As a development from my previous task, I now want to alter my SVG shapes using Java Script buttons using the 'onclick' procedure.

I have tried using it this way:

<input id="button1" type="button" value="Rotate Inner Short Arrows 45*"onclick="rotatex()"/>
<script>

function rotatex() {
document.getElementById("inner-arrow").setRotate(45,NativeCenterX,NativeCenterY)}
</script>

but every time I click the button nothing happens

I am a beginner in this language so would appreciate all the help I could get.

Thanks

Upvotes: 0

Views: 111

Answers (1)

Francis Hemsher
Francis Hemsher

Reputation: 3488

Try the following:

function rotatex() {
document.getElementById("inner-arrow").setAttribute("transform","rotate(45 "+NativeCenterX+" "+NativeCenterY+")")

Upvotes: 1

Related Questions