SVG LineElement.x2 Property
The SVG LineElement.x2 property is used to return an SVGAnimatedLength object corresponding to the attribute of the given line element.
Syntax:
LineElement.x2
Return Value: This property returns an SVGAnimatedLength object that can be used to get the “x2” value and other properties of the line element.
Example 1:
HTML
<!DOCTYPE html>
< html >
< body >
< h1 style = "color: green" >
GeeksforGeeks
</ h1 >
< h3 >SVG LineElement.x2 property</ h3 >
< svg width = "300" height = "200"
< line x1 = "10" x2 = "100" y1 = "10"
y2 = "150" id = "gfg" stroke = "green" />
< script >
var g = document.getElementById("gfg");
console.log(g.x2)
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 2:
HTML
<!DOCTYPE html>
< html >
< body >
< h1 style = "color: green" >
GeeksforGeeks
</ h1 >
< h3 >SVG LineElement.x2 property</ h3 >
< svg width = "300" height = "200"
< line x1 = "10%" x2 = "75%" y1 = "10%"
y2 = "25%" id = "gfg" stroke = "green" />
< script >
var g = document.getElementById("gfg");
console.log(g.x2)
</ script >
</ svg >
</ body >
</ html >
|
Output:
Last Updated :
30 Mar, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...