Re: animateTransform has no default value for 'type'

Undermining SMIL? No, but maybe trying to offer constructive critique?
In general in any programming language, if there are no means to avoid obvious redundancies — like in this case, for example, writing certain attributes of <animateTransform> many many times although they are always the same — I consider this as a limitation worth criticizing.

The demonstration why there is an unnecessary redundancy I already gave in the code example in the email written May 31. If you think of an extended example where you do not have just two elements being animated but, say 20, then more than half of your code is completely redundant.

By the way, I realized that there is at least a simple way to set attributes globally by setting an attribute list in the DTD. The modified code example would then look like this:


<!DOCTYPE A [
  <!ATTLIST animateTransform
  attributeName CDATA 'transform'
  type CDATA 'translate'
  dur CDATA '7s'
  repeatCount CDATA 'indefinite'>
]>

<svg
version='1.1'
xmlns='http://www.w3.org/2000/svg <http://www.w3.org/2000/svg>'
viewBox='0 0 4 4'
shape-rendering='crispEdges’>

<path d='M1 1 1 2 2 2 2 1Z'><animateTransform values='0,0; 1,0; 1, 1;0, 1;0,0'/></path>
<path d='M2 2 2 3 3 3 3 2Z'><animateTransform values='0,0;-1,0;-1,-1;0,-1;0,0'/></path>

</svg>


Again, the point is that if you have many elements to animate, this makes a big difference in file size, readability, and adaptability (for example, above you can change the duration of the animation by changing just one number).

> On Jun 7, 2017, at 1:57, Domenico Strazzullo <strazzullo.domenico@gmail.com> wrote:
> 
> No way to do what, two different animations on two different elements with the same animation code? It’s not SMIL or CSS that do the animation. You define the animations using either the declarative approach of SMIL or the functional one of CSS. You can use CSS if you think it allows much more concise code.
> 
> 
> On the other end, do I have the impression you are bringing forward an argument (which you don’t demonstrate) for the undermining of SMIL?
> 
> On Tue, Jun 6, 2017 at 4:24 PM, Johannes Schoenke <johannes.schoenke@gmail.com <mailto:johannes.schoenke@gmail.com>> wrote:
> 2) So I guess that in an SVG 2.0 standard there would still be no way to do this because it is still SMIL?
> In this case I think it might be better to let CSS do the animation because it allows for a much more concise code.
> 
> 
>> On Jun 1, 2017, at 1:57, Domenico Strazzullo <strazzullo.domenico@gmail.com <mailto:strazzullo.domenico@gmail.com>> wrote:
>> 
>> 1) Basically we have Firefox with the correct implementation versus the webkit with the wrong one.
>> 
>> 2) OK, but <animateTransform> being a SMIL animation element (hosted by SVG) is unique and cannot be re<use>d with different values. 
>> 
>> On Wed, May 31, 2017 at 5:07 PM, Johannes Schoenke <johannes.schoenke@gmail.com <mailto:johannes.schoenke@gmail.com>> wrote:
>> 1) I’m sorry, Firefox was the one I didn’t test. It appears like the default value is not implemented in Chrome, Opera, and Safari (IE/Edge I have no idea and honestly don’t care). That’s sad.
>> 
>> 2) That was not what I meant. Maybe I didn’t explain precisely enough. I'll give an example:
>> I want this
>> 
>> <path d='M1 1 1 2 2 2 2 1Z'>
>>   <animateTransform attributeName='transform' type='translate' dur='7s' repeatCount='indefinite' values='0,0;1,0;1,1;0,1;0,0'/>
>> </path>
>> <path d='M2 2 2 3 3 3 3 2Z'>
>>   <animateTransform attributeName='transform' type='translate' dur='7s' repeatCount='indefinite' values='0,0;-1,0;-1,-1;0,-1;0,0'/>
>> </path>
>> 
>> to be expressible as this
>> 
>> <g>
>>   <animateTransform attributeName='transform' type='translate' dur='7s' repeatCount='indefinite'/>
>>   
>>   <path d='M1 1 1 2 2 2 2 1Z'>
>>     <animateTransform values='0,0;1,0;1,1;0,1;0,0'/>
>>   </path>
>>   <path d='M2 2 2 3 3 3 3 2Z'>
>>     <animateTransform values='0,0;-1,0;-1,-1;0,-1;0,0'/>
>>   </path>
>> </g>
>> 
>> So all the animation attributes which are identical for both <paths> I just want to have to write once.
>> 
>> 
>> Hannes
>> 
>> 
>>> On May 31, 2017, at 22:51, Domenico Strazzullo <strazzullo.domenico@gmail.com <mailto:strazzullo.domenico@gmail.com>> wrote:
>>> 
>>> 1) The 'type' attribute of 'animateTransform' does have the default value of 'translate', since the specification says so. Firefox implements correctly and executes a translation if 'type' is not specified (lines 9 and 15 in the example below). Chrome doesn’t. You can report the bug with Chrome, but I'm not sure if they care any longer.
>>> 
>>> 
>>> 
>>> 2) Animations for a group of different objects (including nested groups) ARE definable for the group:
>>> 
>>> 
>>> 
>>> <g>
>>> 
>>>   <set attributeName="visibility" to="hidden" begin="20s"/>
>>> 
>>>   <animateTransform attributeName="transform" type="skewX" from="90" to="0" begin="0s" dur="5s"/>
>>> 
>>>   <g>
>>> 
>>>     <animateTransform attributeName="transform" type="skewY" from="-45" to="0" begin="0s" dur="5s"/>
>>> 
>>>     <g id="tubes">
>>> 
>>>       <animateTransform attributeName="transform" type="scale" from="0" to="1" begin="0s" dur="5s" fill="freeze"/>
>>> 
>>>         <g id="hor1">
>>> 
>>>    <animateTransform attributeName="transform" from="150 750" to="150 150" begin="0s" dur="5s" fill="freeze"/>
>>> 
>>>    <use xlink:href="#left_cap"/>
>>> 
>>>    <use xlink:href="#right_cap" transform="translate(360 0)"/>
>>> 
>>>    <use id="t1" transform="scale(3.6 1)" xlink:href="#h_tube"/>
>>> 
>>>  </g>
>>> 
>>>  <g id="vert1">
>>> 
>>>    <animateTransform attributeName="transform" from="74 574" to="474 174" begin="0s" dur="5s" fill="freeze"/>
>>> 
>>>    <use xlink:href="#top_cap"/>
>>> 
>>>    <use xlink:href="#bottom_cap" transform="translate(0 125)"/>
>>> 
>>>    <use transform="scale(1 1.25)" xlink:href="#v_tube"/>
>>> 
>>>  </g>
>>> 
>>>         ...
>>> 
>>> </g>
>>> 
>>> 
>>> 
>>> It is wise before making a suggestion literally, to ask or double-check, because if nobody replies then other readers might see it as a valid suggestion. Some changes to the spec in the past were introduced out of confusional debating where there was no need, without proper auditing.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Domenico Strazzullo
>>> 
>>> 
>>> 
>>> 
>>> On Mon, May 29, 2017 at 4:17 PM, Johannes Schoenke <johannes.schoenke@gmail.com <mailto:johannes.schoenke@gmail.com>> wrote:
>>> I could not find anything about this in the mailing list, so I thought a share.
>>> 
>>> In the SVG 1.1 standard section 19.2.16, right at the beginning of ‘Attribute definitions’ it says about the ‘type’ attribute:
>>> 
>>> ‘… . If the attribute [type] is not specified, then the effect is as if a value of 'translate' were specified.’
>>> 
>>> This is not true.
>>> If ‘type’ is not specified, nothing gets animated.
>>> So it seems like ‘type’ has no default value.
>>> 
>>> Hope this helps.
>>> 
>>> Best wishes,
>>> Hannes
>>> 
>>> 
>>> P.S.: Suggestion for the next standard:
>>> For ‘animateTransform’ and all related animation tags attributes like for example
>>> 
>>> attributeName='transform' type='translate' fill='freeze' dur=‘4s’ …
>>> 
>>> Should be definable for a group of different objects/animations. At the moment one has to write them for every single animation tag. Many animated SVG files would probably be half the size with this feature!
>>> 
>>>  <https://www.w3.org/TR/SVG/Overview.html>
>> 
>> 
> 
> 

Received on Thursday, 8 June 2017 12:53:28 UTC