jquery - SVG hover with transition -
I have recently started learning SVG I tried to create a circle with some text inside. Here's my code:
& lt; Div class = "main_circle" & gt; & Lt; A href = "#" & gt; & Lt; Svg height = "392" width = "392" id = "svg_circle" & gt; & Lt; Circle cx = "196" cy = "1 9 6" r = "1 9 4" square = "circle 1" id = "circle1" /> & Lt; Text x = "70" y = "100" font-size = "30" fill = "#fff"> & Lt; Tspan font-family = "Ubuntu, without-serif" font-weight = "100" & gt; Some text & lt; / Tspan & gt; Sorry, your browser does not support inline SVG. & Lt; / Svg & gt; & Lt; / A & gt; & Lt; Script & gt; $ ("#svg_circle") .hor (function () {$ ("# circle1"). Attr ({r: "150"})}} $ ("# svg_circle") .mouseleave (function () {$ ("# Circle1"). Attr ({r: "194"}}}} It should be small when I rotate it and the text disappears, if possible, I received it to minimize, but I want to transition to look good. If someone can help me, then appreciate it.
Animate text opacity and position For the keyword, use g tags by using circle and text to group a : hover event Attach, animate from 1 to filling-opacity to #text and conversion <0> and conversion: To move the translation (0, 100px) above 100px .
Code> tags and can start the animation on mouseenter and mo Useleave / <>
var size = document.getElementById ('size'); Shape.addEventListener ('mouseenter', function () {document.getElementById ('shrink'). BeginElement ();}); Shape.addEventListener ('mouseleave', function () {document.getElementById ('moving'). BeginElement ();}); #shape #text {transitions: all 0.5s ease; } # Shape: hover # text {fill-opacity: 0; Conversion: Translation (0, 100px); }
& lt; Div class = "main_circle" & gt; & Lt; Svg height = "392" width = "392" id = "svg_circle" & gt; & Lt; G id = "size" & gt; & Lt; A xlink: href = "#" & gt; & Lt; Circle cx = "196" cy = "196" r = "1 9 4" square = "circle" id = "circle" /> & Lt; Anime ID = "Shrink" Xlink: Start the "=" 150 "Fear =" 0.5 "" = "0" "attribute type =" XML "attribute type =" XML "attribute name =" R "=" 194 "= =" indefinite " "Freeze" double encrypt = "1" /> & Lt; Id = "increase" xlink: href = "# circle" attributeType = "XML" attributeName = "r" = "150" = "194" dur = "0.5s" start = "unsure" fill = "freeze" repeat = "1" /> & Lt; Text id = "text" font-family = "Ubuntu", sans-serif "opacity =" 1 "font-weight =" 100 "x =" 196 "y =" 1 9 6 "text-anchor =" medium "font Lt; / div>
Comments
Post a Comment