New issue
Advanced search Search tips

Issue 740381 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 2
Type: Bug



Sign in to add a comment

SVG: SMIL animations that modify element visibility break

Reported by paul.leb...@gmail.com, Jul 9 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce the problem:
If an SMIL animation makes an element invisible, then it intermittently affects the correct behaviour of the animation.

Consider the following sample: https://jsfiddle.net/0coeo4ef/

<svg width="500" height="500" viewBox="0 0 150 150">

   <image xlink:href="http://lorempixel.com/output/cats-q-c-30-30-1.jpg" height="30" width="30" x="80" y="100">
     <animate id="one" attributeName="x" begin="0s;three.end+2s" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="0s;three.end+2s" dur="1s" fill="freeze"
              from="100" to="100"/>
     <set attributeName="opacity" to="1" begin="0s;three.end+2s" fill="freeze"/>
     <set attributeName="opacity" to="0" begin="three.end+1s"/>
   </image>

   <image xlink:href="http://lorempixel.com/output/food-q-c-30-30-3.jpg" height="30" width="30" x="80" y="100"
          opacity="0">
     <animate id="two" attributeName="x" begin="one.end" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="one.end" dur="1s" fill="freeze"
              from="100" to="70"/>
     <set attributeName="opacity" to="1" begin="one.end" fill="freeze"/>
     <set attributeName="opacity" to="0" begin="three.end+1s"/>
   </image>

   <image xlink:href="http://lorempixel.com/output/people-q-c-30-30-3.jpg" height="30" width="30" x="80" y="100"
          opacity="0">
     <animate id="three" attributeName="x" begin="two.end" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="two.end" dur="1s" fill="freeze"
              from="100" to="40"/>
     <set attributeName="opacity" to="1" begin="two.end" fill="freeze"/>
     <set attributeName="opacity" to="0" begin="three.end+1s"/>
   </image>

</svg>

If you run this in Chrome 59, you should find that one of the images will intermittently not reappear when they are supposed. Sometimes it is the second image. Sometimes the third.  It's also non-deterministic. If you tweak the attributes a little - or the order of the <set> and <animate> elements, you can get a different result.

The same happens if you use visibility instead of opacity: https://jsfiddle.net/0coeo4ef/2/

<svg width="500" height="500" viewBox="0 0 150 150">

   <image xlink:href="http://lorempixel.com/output/cats-q-c-30-30-1.jpg" height="30" width="30" x="80" y="100">
     <animate id="one" attributeName="x" begin="0s;three.end+2s" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="0s;three.end+2s" dur="1s" fill="freeze"
              from="100" to="100"/>
     <set attributeName="visibility" to="visible" begin="0s;three.end+2s" fill="freeze"/>
     <set attributeName="visibility" to="hidden" begin="three.end+1s"/>
   </image>

   <image xlink:href="http://lorempixel.com/output/food-q-c-30-30-3.jpg" height="30" width="30" x="80" y="100"
          visibility="hidden">
     <animate id="two" attributeName="x" begin="one.end" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="one.end" dur="1s" fill="freeze"
              from="100" to="70"/>
     <set attributeName="visibility" to="visible" begin="one.end" fill="freeze"/>
     <set attributeName="visibility" to="hidden" begin="three.end+1s"/>
   </image>

   <image xlink:href="http://lorempixel.com/output/people-q-c-30-30-3.jpg" height="30" width="30" x="80" y="100"
          visibility="hidden">
     <animate id="three" attributeName="x" begin="two.end" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="two.end" dur="1s" fill="freeze"
              from="100" to="40"/>
     <set attributeName="visibility" to="visible" begin="two.end" fill="freeze"/>
     <set attributeName="visibility" to="hidden" begin="three.end+1s"/>
   </image>

</svg>

However if you don't go fully invisible (eg. opacity="0.1") everything seems to work perfectly: https://jsfiddle.net/0coeo4ef/1/

<svg width="500" height="500" viewBox="0 0 150 150">

   <image xlink:href="http://lorempixel.com/output/cats-q-c-30-30-1.jpg" height="30" width="30" x="80" y="100">
     <animate id="one" attributeName="x" begin="0s;three.end+2s" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="0s;three.end+2s" dur="1s" fill="freeze"
              from="100" to="100"/>
     <set attributeName="opacity" to="1" begin="0s;three.end+2s" fill="freeze"/>
     <set attributeName="opacity" to="0.1" begin="three.end+1s"/>
   </image>

   <image xlink:href="http://lorempixel.com/output/food-q-c-30-30-3.jpg" height="30" width="30" x="80" y="100"
          opacity="0.1">
     <animate id="two" attributeName="x" begin="one.end" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="one.end" dur="1s" fill="freeze"
              from="100" to="70"/>
     <set attributeName="opacity" to="1" begin="one.end" fill="freeze"/>
     <set attributeName="opacity" to="0.1" begin="three.end+1s"/>
   </image>

   <image xlink:href="http://lorempixel.com/output/people-q-c-30-30-3.jpg" height="30" width="30" x="80" y="100"
          opacity="0.1">
     <animate id="three" attributeName="x" begin="two.end" dur="1s" fill="freeze"
              from="80" to="100"/>
     <animate attributeName="y" begin="two.end" dur="1s" fill="freeze"
              from="100" to="40"/>
     <set attributeName="opacity" to="1" begin="two.end" fill="freeze"/>
     <set attributeName="opacity" to="0.1" begin="three.end+1s"/>
   </image>

</svg>

What is the expected behavior?
Elements should reappear at the same time as they begin to move across the canvas.

What went wrong?
Sometimes through the loop they don't reappear when they should.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 59.0.3071.115  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: 

Tweaking the timing of when we make the element visible doesn't seem to help at all.  For instance I tried having it reappear 0.1s before it starts moving, but the fault still happens.
 

Comment 1 by f...@opera.com, Jul 9 2017

Labels: OS-Android OS-Chrome OS-Fuchsia OS-Linux OS-Mac
Status: Available (was: Unconfirmed)
"However if you don't go fully invisible (eg. opacity="0.1") everything seems to work..."

I'm not sure if that is true - except maybe by luck =). FTR, I did see the same effect in that case as in the one with 0/1 opacity (i.e one or two of the elements appear as opacity 0.1 when they should've been 1.)

This is probably an issue with incorrect order of application due to time dependence (because of the syncbases used.) I think there are other bugs filed with similar effects. (IIRC sorting based on syncbases isn't actually implemented, meaning that it's essentially based on instance times - which makes it very fragile in its current form.)
You might be right. That one worked every time for me. But I am not surprised if that was a fluke. The other ones were very sensitive to run conditions. Sometimes even just reloading the page caused it to behave slightly differently.

Comment 3 by f...@opera.com, Jul 9 2017

Yes, this could be sensitive to a variety of things - even factors such as the address of the elements involved (which means ordering differences in various sets used by the implementation...)
Project Member

Comment 4 by sheriffbot@chromium.org, Jul 10

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
This fault is still happening.  The behaviour is still as described.

Status: Available (was: Untriaged)
Summary: SVG: SMIL animations that modify element visibility break (was: SVG: SMIL animations that modify elelment visibility break)

Sign in to add a comment