Closed Bug 873416 Opened 13 years ago Closed 13 years ago

Problem with beginElement & endElement in SVG Animation

Categories

(Core :: SVG, defect)

18 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: manu.krgl, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 (Beta/Release) Build ID: 20130116073211 Steps to reproduce: I have a web page where i used SVG. I wanted to animate SVG element from java script. I created AnimateTransform DOM object in Java script and appended it to the SVG element. Actual results: Now, I called beginElement on AnimateTransform DOM object. It worked fine but, if i call endElement soon after beginElement it is supposed to stop animation. in fact it ignores the endElement. And this is vice verse if i call begin immediately after end begin is ignored. Expected results: begin or end shouldn't be ignored.
If i try debugging by putting breakpoints on begin & end it works well.
Please attach a testcase to this bug unless by comment 2 you're saying the bug is invalid?
Flags: needinfo?(manu.krgl)
Testcase for the above problem
Flags: needinfo?(manu.krgl)
(In reply to Robert Longson from comment #2) > Please attach a testcase to this bug unless by comment 2 you're saying the > bug is invalid? Hi Robert thanks for the reply... I have attached the testcase. PFA..
Attachment #751334 - Attachment mime type: text/plain → text/html
Component: Untriaged → SVG
Product: Firefox → Core
beginElement() is short for beginElementAt(0) endElement() is short for endElementAt(0) The first call starts the animation at time 0. I.e. immediately The second call stops the animation at time 0 but that is now in the past as the animation started when beginElement() was called. Per http://www.w3.org/TR/2001/REC-smil-animation-20010904/#ResettingElementState any times in the past are ignored. Opera works this way as does Chrome. Any UA that doesn't is invalid and you should raise a bug on that instead.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
And if you do want the element to end now, you can use: animationElt.endElement(document.documentElement.getCurrentTime()); Alternatively, you can remove the animation element from the DOM, which will also stop it.
Summary: Problem with begingElement & endElement in SVG Animation → Problem with beginElement & endElement in SVG Animation
I think Cameron meant endElementAt
(In reply to Robert Longson from comment #5) > beginElement() is short for beginElementAt(0) > endElement() is short for endElementAt(0) > > The first call starts the animation at time 0. I.e. immediately > > The second call stops the animation at time 0 but that is now in the past as > the animation started when beginElement() was called. Per > http://www.w3.org/TR/2001/REC-smil-animation-20010904/#ResettingElementState > any times in the past are ignored. > > Opera works this way as does Chrome. Any UA that doesn't is invalid and you > should raise a bug on that instead. Hi Robert.. if endElement is short for endElementAt(0). I tried the below update on the attached testcase. animate.beginElement(); function stop(){animate.endElement();} setTimeout(stop,1000); So according your theory endElement should be ignored. In fact animation is stopped after 1s. And coming to chrome browser it doesn't animate for the attached testcase. But if i call beginElement->endElement->beginElement it suppose to restart animation but it doesn't. if i use beginElement -> endElement -> 1ms delay -> beginElement it works well. In chrome if i add 1ms delay b/w each of these it works smoothly.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
(In reply to Cameron McCormack (:heycam) from comment #6) > And if you do want the element to end now, you can use: > > animationElt.endElement(document.documentElement.getCurrentTime()); > > Alternatively, you can remove the animation element from the DOM, which will > also stop it. Hi Cameron thanks for the reply... I'm getting the below error. TypeError: document.documentElement.getCurrentTime is not a function And about your alternative suggestion. I wish to reuse already existing animation by just changing values and calling beginElement. Otherwise i have to create every time i need animation.
The interval 0 to 1 seconds as defined by the function stop(){animate.endElement();} setTimeout(stop,1000); call is a valid interval. Your original testcase with an interval of 0 - 0 seconds is not valid. Per http://www.w3.org/TR/2001/REC-smil-animation-20010904/#IntervalTiming the end time must be strictly after the begin time.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → INVALID
Chrome doesn't animate the attached testcase but firefox does. What is the reason? why it is not consistent?
Hi Robert Since 1s is bigger delay for our scenario, I tried with a smaller interval of 5ms, i.e. function stop(){animate.endElement();} setTimeout(stop,5); With this, the result in firefox is observed to be inconsistent, as I try refreshing the page multiple times (sometimes it stops animating and other times it doesn't).
There is a minimum duration that we support. We have bug 733744 open to look into that.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: