Konstantin Zakablukovsky 9 лет назад
Родитель
Сommit
ab7d1312a9

+ 3 - 0
include/nitro.hrl

@@ -202,6 +202,9 @@
 
 % Extras
 -record(upload,         {?CTRL_BASE(element_upload), name, value}).
+-record(animate, {?ELEMENT_BASE(element_animate), externalResourcesRequired, ?SVG_ANIMATION_EVENT, ?SVG_ANIMATION_ATTRIBUT_TARGET, ?SVG_ANIMATION_TIMING, ?SVG_ANIMATION_VALUE, ?SVG_ANIMATION_ADDITION, ?SVG_CONDITIONAL_PROCESSING, ?SVG_CORE, ?SVG_XLINK}).
+-record(animateMotion, {?ELEMENT_BASE(element_animatemotion), path, keyPoints, rotate, origin, externalResourcesRequired, ?SVG_ANIMATION_EVENT, ?SVG_ANIMATION_TIMING, ?SVG_ANIMATION_VALUE, ?SVG_ANIMATION_ADDITION,  ?SVG_CONDITIONAL_PROCESSING, ?SVG_CORE, ?SVG_XLINK}).
+-record(animateTransform, {?ELEMENT_BASE(element_animatetransform), type, externalResourcesRequired, ?SVG_ANIMATION_EVENT, ?SVG_ANIMATION_ATTRIBUT_TARGET, ?SVG_ANIMATION_TIMING, ?SVG_ANIMATION_VALUE, ?SVG_ANIMATION_ADDITION, ?SVG_CONDITIONAL_PROCESSING, ?SVG_CORE, ?SVG_XLINK}).
 
 % Actions
 -record(action,  {?ACTION_BASE(undefined)}).

+ 87 - 0
src/elements/element_animate.erl

@@ -0,0 +1,87 @@
+-module(element_animate).
+-author('Konstantin Zakablukovsky').
+-include("nitro.hrl").
+-compile(export_all).
+%% -import(element_svg, [svg_conditional_processing/1, svg_core/1, svg_xlink/1]).
+
+render_element(Record) ->
+	wf_tags:emit_tag(<<"animate">>, nitro:render(Record#animate.body),
+	lists:append([
+		[
+			{<<"id">>, Record#animate.id},
+			{<<"class">>, Record#animate.class},
+			{<<"style">>, Record#animate.style},
+			{<<"externalResourcesRequired">>, Record#animate.externalResourcesRequired}
+		],
+		svg_animation_event(Record),
+		svg_animation_attribut_target(Record),
+		svg_animation_timing(Record),
+		svg_animation_value(Record),
+		svg_animation_addition(Record),
+		svg_conditional_processing(Record),
+		svg_core(Record),
+		svg_xlink(Record),
+		Record#animate.data_fields,
+		Record#animate.aria_states
+	])).
+
+svg_conditional_processing(Record)-> [
+	{<<"requiredExtensions">>, Record#animate.requiredExtensions},
+	{<<"requiredFeatures">>, Record#animate.requiredFeatures},
+	{<<"systemLanguage">>, Record#animate.systemLanguage}
+].
+
+svg_core(Record)-> [
+	{<<"xml:base">>, Record#animate.xmlbase},
+	{<<"xml:lang">>, Record#animate.xmllang},
+	{<<"xml:space">>, Record#animate.xmlspace}
+].
+
+svg_xlink(Record)-> [
+	{<<"xlink:href">>, Record#animate.xlinkhref},
+	{<<"xlink:type">>, Record#animate.xlinktype},
+	{<<"xlink:role">>, Record#animate.xlinkrole},
+	{<<"xlink:arcrole">>, Record#animate.xlinkarcrole},
+	{<<"xlink:title">>, Record#animate.xlinktitle},
+	{<<"xlink:show">>, Record#animate.xlinkshow},
+	{<<"xlink:actuate">>, Record#animate.xlinkactuate}
+].
+
+% Common SVG animate attributes
+svg_animation_event(Record) -> [
+	{<<"onbegin">>, Record#animate.onbegin},
+	{<<"onend">>, Record#animate.onend},
+	{<<"onload">>, Record#animate.onload_animation},
+	{<<"onrepeat">>, Record#animate.onrepeat}
+].
+svg_animation_attribut_target(Record) -> [
+	{<<"attributeType">>, Record#animate.attributeType},
+	{<<"attributeName">>, Record#animate.attributeName}
+].
+svg_animation_timing(Record) -> [
+	{<<"begin">>, Record#animate.svgbegin},
+	{<<"dur">>, Record#animate.dur},
+	{<<"end">>, Record#animate.svgend},
+	{<<"min">>, Record#animate.min},
+	{<<"max">>, Record#animate.max},
+	{<<"restart">>, Record#animate.restart},
+	{<<"repeatCount">>, Record#animate.repeatCount},
+	{<<"repeatDur">>, Record#animate.repeatDur},
+	{<<"fill">>, Record#animate.fill}
+].
+svg_animation_value(Record) -> [
+	{<<"calcMode">>, Record#animate.calcMode},
+	{<<"values">>, Record#animate.values},
+	{<<"keyTimes">>, Record#animate.keyTimes},
+	{<<"keySplines">>, Record#animate.keySplines},
+	{<<"from">>, Record#animate.from},
+	{<<"to">>, Record#animate.to},
+	{<<"by">>, Record#animate.by},
+	{<<"autoReverse">>, Record#animate.autoReverse},
+	{<<"accelerate">>, Record#animate.accelerate},
+	{<<"decelerate">>, Record#animate.decelerate}
+].
+svg_animation_addition(Record) -> [
+	{<<"additive">>, Record#animate.additive},
+	{<<"accumulate">>, Record#animate.accumulate}
+].

+ 86 - 0
src/elements/element_animatemotion.erl

@@ -0,0 +1,86 @@
+-module(element_animatemotion).
+-author('Konstantin Zakablukovsky').
+-include("nitro.hrl").
+-compile(export_all).
+%% -import(element_svg, [svg_conditional_processing/1, svg_core/1, svg_xlink/1]).
+
+render_element(Record) ->
+	wf_tags:emit_tag(<<"animateMotion">>, nitro:render(Record#animateMotion.body),
+	lists:append([
+		[
+			{<<"id">>, Record#animateMotion.id},
+			{<<"class">>, Record#animateMotion.class},
+			{<<"style">>, Record#animateMotion.style},
+			{<<"path">>, Record#animateMotion.path},
+			{<<"keyPoints">>, Record#animateMotion.keyPoints},
+			{<<"rotate">>, Record#animateMotion.rotate},
+			{<<"origin">>, Record#animateMotion.origin},
+			{<<"externalResourcesRequired">>, Record#animateMotion.externalResourcesRequired}
+		],
+		svg_animation_event(Record),
+		svg_animation_timing(Record),
+		svg_animation_value(Record),
+		svg_animation_addition(Record),
+		svg_conditional_processing(Record),
+		svg_core(Record),
+		svg_xlink(Record),
+		Record#animateMotion.data_fields,
+		Record#animateMotion.aria_states
+	])).
+
+svg_conditional_processing(Record)-> [
+	{<<"requiredExtensions">>, Record#animateMotion.requiredExtensions},
+	{<<"requiredFeatures">>, Record#animateMotion.requiredFeatures},
+	{<<"systemLanguage">>, Record#animateMotion.systemLanguage}
+].
+
+svg_core(Record)-> [
+	{<<"xml:base">>, Record#animateMotion.xmlbase},
+	{<<"xml:lang">>, Record#animateMotion.xmllang},
+	{<<"xml:space">>, Record#animateMotion.xmlspace}
+].
+
+svg_xlink(Record)-> [
+	{<<"xlink:href">>, Record#animateMotion.xlinkhref},
+	{<<"xlink:type">>, Record#animateMotion.xlinktype},
+	{<<"xlink:role">>, Record#animateMotion.xlinkrole},
+	{<<"xlink:arcrole">>, Record#animateMotion.xlinkarcrole},
+	{<<"xlink:title">>, Record#animateMotion.xlinktitle},
+	{<<"xlink:show">>, Record#animateMotion.xlinkshow},
+	{<<"xlink:actuate">>, Record#animateMotion.xlinkactuate}
+].
+
+% Common SVG animateMotion attributes
+svg_animation_event(Record) -> [
+	{<<"onbegin">>, Record#animateMotion.onbegin},
+	{<<"onend">>, Record#animateMotion.onend},
+	{<<"onload">>, Record#animateMotion.onload_animation},
+	{<<"onrepeat">>, Record#animateMotion.onrepeat}
+].
+svg_animation_timing(Record) -> [
+	{<<"begin">>, Record#animateMotion.svgbegin},
+	{<<"dur">>, Record#animateMotion.dur},
+	{<<"end">>, Record#animateMotion.svgend},
+	{<<"min">>, Record#animateMotion.min},
+	{<<"max">>, Record#animateMotion.max},
+	{<<"restart">>, Record#animateMotion.restart},
+	{<<"repeatCount">>, Record#animateMotion.repeatCount},
+	{<<"repeatDur">>, Record#animateMotion.repeatDur},
+	{<<"fill">>, Record#animateMotion.fill}
+].
+svg_animation_value(Record) -> [
+	{<<"calcMode">>, Record#animateMotion.calcMode},
+	{<<"values">>, Record#animateMotion.values},
+	{<<"keyTimes">>, Record#animateMotion.keyTimes},
+	{<<"keySplines">>, Record#animateMotion.keySplines},
+	{<<"from">>, Record#animateMotion.from},
+	{<<"to">>, Record#animateMotion.to},
+	{<<"by">>, Record#animateMotion.by},
+	{<<"autoReverse">>, Record#animateMotion.autoReverse},
+	{<<"accelerate">>, Record#animateMotion.accelerate},
+	{<<"decelerate">>, Record#animateMotion.decelerate}
+].
+svg_animation_addition(Record) -> [
+	{<<"additive">>, Record#animateMotion.additive},
+	{<<"accumulate">>, Record#animateMotion.accumulate}
+].

+ 88 - 0
src/elements/element_animatetransform.erl

@@ -0,0 +1,88 @@
+-module(element_animatetransform).
+-author('Konstantin Zakablukovsky').
+-include("nitro.hrl").
+-compile(export_all).
+%% -import(element_svg, [svg_conditional_processing/1, svg_core/1, svg_xlink/1]).
+
+render_element(Record) ->
+	wf_tags:emit_tag(<<"animateTransform">>, nitro:render(Record#animateTransform.body),
+	lists:append([
+		[
+			{<<"id">>, Record#animateTransform.id},
+			{<<"class">>, Record#animateTransform.class},
+			{<<"style">>, Record#animateTransform.style},
+			{<<"type">>, Record#animateTransform.type},
+			{<<"externalResourcesRequired">>, Record#animateTransform.externalResourcesRequired}
+		],
+		svg_animation_event(Record),
+		svg_animation_attribut_target(Record),
+		svg_animation_timing(Record),
+		svg_animation_value(Record),
+		svg_animation_addition(Record),
+		svg_conditional_processing(Record),
+		svg_core(Record),
+		svg_xlink(Record),
+		Record#animateTransform.data_fields,
+		Record#animateTransform.aria_states
+	])).
+
+svg_conditional_processing(Record)-> [
+	{<<"requiredExtensions">>, Record#animateTransform.requiredExtensions},
+	{<<"requiredFeatures">>, Record#animateTransform.requiredFeatures},
+	{<<"systemLanguage">>, Record#animateTransform.systemLanguage}
+].
+
+svg_core(Record)-> [
+	{<<"xml:base">>, Record#animateTransform.xmlbase},
+	{<<"xml:lang">>, Record#animateTransform.xmllang},
+	{<<"xml:space">>, Record#animateTransform.xmlspace}
+].
+
+svg_xlink(Record)-> [
+	{<<"xlink:href">>, Record#animateTransform.xlinkhref},
+	{<<"xlink:type">>, Record#animateTransform.xlinktype},
+	{<<"xlink:role">>, Record#animateTransform.xlinkrole},
+	{<<"xlink:arcrole">>, Record#animateTransform.xlinkarcrole},
+	{<<"xlink:title">>, Record#animateTransform.xlinktitle},
+	{<<"xlink:show">>, Record#animateTransform.xlinkshow},
+	{<<"xlink:actuate">>, Record#animateTransform.xlinkactuate}
+].
+
+% Common SVG animateTransform attributes
+svg_animation_event(Record) -> [
+	{<<"onbegin">>, Record#animateTransform.onbegin},
+	{<<"onend">>, Record#animateTransform.onend},
+	{<<"onload">>, Record#animateTransform.onload_animation},
+	{<<"onrepeat">>, Record#animateTransform.onrepeat}
+].
+svg_animation_attribut_target(Record) -> [
+	{<<"attributeType">>, Record#animateTransform.attributeType},
+	{<<"attributeName">>, Record#animateTransform.attributeName}
+].
+svg_animation_timing(Record) -> [
+	{<<"begin">>, Record#animateTransform.svgbegin},
+	{<<"dur">>, Record#animateTransform.dur},
+	{<<"end">>, Record#animateTransform.svgend},
+	{<<"min">>, Record#animateTransform.min},
+	{<<"max">>, Record#animateTransform.max},
+	{<<"restart">>, Record#animateTransform.restart},
+	{<<"repeatCount">>, Record#animateTransform.repeatCount},
+	{<<"repeatDur">>, Record#animateTransform.repeatDur},
+	{<<"fill">>, Record#animateTransform.fill}
+].
+svg_animation_value(Record) -> [
+	{<<"calcMode">>, Record#animateTransform.calcMode},
+	{<<"values">>, Record#animateTransform.values},
+	{<<"keyTimes">>, Record#animateTransform.keyTimes},
+	{<<"keySplines">>, Record#animateTransform.keySplines},
+	{<<"from">>, Record#animateTransform.from},
+	{<<"to">>, Record#animateTransform.to},
+	{<<"by">>, Record#animateTransform.by},
+	{<<"autoReverse">>, Record#animateTransform.autoReverse},
+	{<<"accelerate">>, Record#animateTransform.accelerate},
+	{<<"decelerate">>, Record#animateTransform.decelerate}
+].
+svg_animation_addition(Record) -> [
+	{<<"additive">>, Record#animateTransform.additive},
+	{<<"accumulate">>, Record#animateTransform.accumulate}
+].