i18n: Sync translations with Weblate
This commit is contained in:
@@ -83,12 +83,17 @@
|
||||
# José Artigas <squander@users.noreply.hosted.weblate.org>, 2024.
|
||||
# Zgtale <zgtale1@hotmail.com>, 2024.
|
||||
# Juan Matias Olmos <ma7as@protonmail.com>, 2024.
|
||||
# Juan Castro <castrotio09172002@gmail.com>, 2024.
|
||||
# Alejandro Moctezuma <moctezumaalejandro25@gmail.com>, 2024.
|
||||
# gallegonovato <fran-carro@hotmail.es>, 2024.
|
||||
# Andres David Calderon <andresdavidcalderonjimenez@gmail.com>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Godot Engine class reference\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/godotengine/godot\n"
|
||||
"PO-Revision-Date: 2024-07-30 16:40+0000\n"
|
||||
"Last-Translator: Juan Matias Olmos <ma7as@protonmail.com>\n"
|
||||
"PO-Revision-Date: 2024-08-07 15:09+0000\n"
|
||||
"Last-Translator: Andres David Calderon <andresdavidcalderonjimenez@gmail."
|
||||
"com>\n"
|
||||
"Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/"
|
||||
"godot-class-reference/es/>\n"
|
||||
"Language: es\n"
|
||||
@@ -168,7 +173,7 @@ msgid "Theme Property Descriptions"
|
||||
msgstr "Descripciones de las propiedades del tema"
|
||||
|
||||
msgid "Inherits:"
|
||||
msgstr "Herencia:"
|
||||
msgstr "Hereda:"
|
||||
|
||||
msgid "Inherited By:"
|
||||
msgstr "Heredado por:"
|
||||
@@ -180,13 +185,13 @@ msgid "Default"
|
||||
msgstr "Predeterminado"
|
||||
|
||||
msgid "Setter"
|
||||
msgstr "Método de Establecimiento o Setter"
|
||||
msgstr "Setter"
|
||||
|
||||
msgid "value"
|
||||
msgstr "valor"
|
||||
|
||||
msgid "Getter"
|
||||
msgstr "Método de Acceso al Valor o Getter"
|
||||
msgstr "Getter"
|
||||
|
||||
msgid ""
|
||||
"This method should typically be overridden by the user to have any effect."
|
||||
@@ -1521,6 +1526,34 @@ msgstr ""
|
||||
"argumentos de cualquier tipo en una cadena de la mejor manera posible y los "
|
||||
"imprime en la consola."
|
||||
|
||||
msgid ""
|
||||
"Given a [param seed], returns a [PackedInt64Array] of size [code]2[/code], "
|
||||
"where its first element is the randomized [int] value, and the second element "
|
||||
"is the same as [param seed]. Passing the same [param seed] consistently "
|
||||
"returns the same array.\n"
|
||||
"[b]Note:[/b] \"Seed\" here refers to the internal state of the pseudo random "
|
||||
"number generator, currently implemented as a 64 bit integer.\n"
|
||||
"[codeblock]\n"
|
||||
"var a = rand_from_seed(4)\n"
|
||||
"\n"
|
||||
"print(a[0])\t# Prints 2879024997\n"
|
||||
"print(a[1])\t# Prints 4\n"
|
||||
"[/codeblock]"
|
||||
msgstr ""
|
||||
"dado un [param seed], retorna un [PackedInt64Array] de tamaño [code]2[/code], "
|
||||
"donde su primer elemento es el valor aleatorizado [int], y el segundo "
|
||||
"elemento es el mismo que [param seed]. Pasar el mismo [param seed] "
|
||||
"consistentemente retorna el mismo array.\n"
|
||||
"[b]Nota:[/b] \"Semila\" Aquí se refiere al estado interno del generador de "
|
||||
"numeros pseudo aleatorio, en este momento implementado como un entero de 64 "
|
||||
"bits.\n"
|
||||
"[codeblock]\n"
|
||||
"var a = rand_from_seed(4)\n"
|
||||
"\n"
|
||||
"print(a[0]\t)# Prints 2879024997\n"
|
||||
"print(a[1])\t# Prints 4\n"
|
||||
"[/codeblock]"
|
||||
|
||||
msgid "The [AudioServer] singleton."
|
||||
msgstr "El singleton [AudioServer]."
|
||||
|
||||
@@ -12363,6 +12396,121 @@ msgstr ""
|
||||
msgid "Emitted when node visibility changes."
|
||||
msgstr "Emitido cuando cambia la visibilidad del nodo."
|
||||
|
||||
msgid ""
|
||||
"The [NodePath] built-in [Variant] type represents a path to a node or "
|
||||
"property in a hierarchy of nodes. It is designed to be efficiently passed "
|
||||
"into many built-in methods (such as [method Node.get_node], [method Object."
|
||||
"set_indexed], [method Tween.tween_property], etc.) without a hard dependence "
|
||||
"on the node or property they point to.\n"
|
||||
"A node path is represented as a [String] composed of slash-separated ([code]/"
|
||||
"[/code]) node names and colon-separated ([code]:[/code]) property names (also "
|
||||
"called \"subnames\"). Similar to a filesystem path, [code]\"..\"[/code] and "
|
||||
"[code]\".\"[/code] are special node names. They refer to the parent node and "
|
||||
"the current node, respectively.\n"
|
||||
"The following examples are paths relative to the current node:\n"
|
||||
"[codeblock]\n"
|
||||
"^\"A\" # Points to the direct child A.\n"
|
||||
"^\"A/B\" # Points to A's child B.\n"
|
||||
"^\".\" # Points to the current node.\n"
|
||||
"^\"..\" # Points to the parent node.\n"
|
||||
"^\"../C\" # Points to the sibling node C.\n"
|
||||
"^\"../..\" # Points to the grandparent node.\n"
|
||||
"[/codeblock]\n"
|
||||
"A leading slash means the path is absolute, and begins from the [SceneTree]:\n"
|
||||
"[codeblock]\n"
|
||||
"^\"/root\" # Points to the SceneTree's root Window.\n"
|
||||
"^\"/root/Title\" # May point to the main scene's root node named "
|
||||
"\"Title\".\n"
|
||||
"^\"/root/Global\" # May point to an autoloaded node or scene named "
|
||||
"\"Global\".\n"
|
||||
"[/codeblock]\n"
|
||||
"Despite their name, node paths may also point to a property:\n"
|
||||
"[codeblock]\n"
|
||||
"^\":position\" # Points to this object's position.\n"
|
||||
"^\":position:x\" # Points to this object's position in the x axis.\n"
|
||||
"^\"Camera3D:rotation:y\" # Points to the child Camera3D and its y rotation.\n"
|
||||
"^\"/root:size:x\" # Points to the root Window and its width.\n"
|
||||
"[/codeblock]\n"
|
||||
"In some situations, it's possible to omit the leading [code]:[/code] when "
|
||||
"pointing to an object's property. As an example, this is the case with "
|
||||
"[method Object.set_indexed] and [method Tween.tween_property], as those "
|
||||
"methods call [method NodePath.get_as_property_path] under the hood. However, "
|
||||
"it's generally recommended to keep the [code]:[/code] prefix.\n"
|
||||
"Node paths cannot check whether they are valid and may point to nodes or "
|
||||
"properties that do not exist. Their meaning depends entirely on the context "
|
||||
"in which they're used.\n"
|
||||
"You usually do not have to worry about the [NodePath] type, as strings are "
|
||||
"automatically converted to the type when necessary. There are still times "
|
||||
"when defining node paths is useful. For example, exported [NodePath] "
|
||||
"properties allow you to easily select any node within the currently edited "
|
||||
"scene. They are also automatically updated when moving, renaming or deleting "
|
||||
"nodes in the scene tree editor. See also [annotation @GDScript."
|
||||
"@export_node_path].\n"
|
||||
"See also [StringName], which is a similar type designed for optimized "
|
||||
"strings.\n"
|
||||
"[b]Note:[/b] In a boolean context, a [NodePath] will evaluate to [code]false[/"
|
||||
"code] if it is empty ([code]NodePath(\"\")[/code]). Otherwise, a [NodePath] "
|
||||
"will always evaluate to [code]true[/code]."
|
||||
msgstr ""
|
||||
"El tipo [Variant] integrado [NodePath] representa una ruta a un nodo o "
|
||||
"propiedad en una jerarquía de nodos. Está diseñado para pasarse de manera "
|
||||
"eficiente a muchos métodos integrados (como [method Node.get_node], [method "
|
||||
"Object.set_indexed], [method Tween.tween_property], etc.) sin una dependencia "
|
||||
"estricta del nodo o propiedad al que apuntan.\n"
|
||||
"Una ruta de nodo se representa como una [String] compuesta por nombres de "
|
||||
"nodo separados por barras ([code]/[/code]) y nombres de propiedad separados "
|
||||
"por dos puntos ([code]:[/code]) (también llamados \"subnombres\"). De manera "
|
||||
"similar a una ruta de sistema de archivos, [code]\"..\"[/code] y [code]\".\"[/"
|
||||
"code] son nombres de nodo especiales. Hacen referencia al nodo superior y al "
|
||||
"nodo actual, respectivamente.\n"
|
||||
"Los siguientes ejemplos son rutas relativas al nodo actual:\n"
|
||||
"[codeblock]\n"
|
||||
"^\"A\" # Apunta al hijo directo A.\n"
|
||||
"^\"A/B\" # Apunta al hijo B de A.\n"
|
||||
"^\".\" # Apunta al nodo actual.\n"
|
||||
"^\"..\" # Apunta al nodo padre.\n"
|
||||
"^\"../C\" # Apunta al nodo hermano C.\n"
|
||||
"^\"../..\" # Apunta al nodo abuelo.\n"
|
||||
"[/codeblock]\n"
|
||||
"Una barra diagonal inicial significa que la ruta es absoluta y comienza desde "
|
||||
"[SceneTree]:\n"
|
||||
"[codeblock]\n"
|
||||
"^\"/root\" # Apunta a la ventana raíz de SceneTree.\n"
|
||||
"^\"/root/Title\" # Puede apuntar al nodo raíz de la escena principal llamado "
|
||||
"\"Title\".\n"
|
||||
"^\"/root/Global\" # Puede apuntar a un nodo o escena cargados automáticamente "
|
||||
"llamados \"Global\".\n"
|
||||
"[/codeblock]\n"
|
||||
"A pesar de su nombre, las rutas de nodos también pueden apuntar a una "
|
||||
"propiedad:\n"
|
||||
"[codeblock]\n"
|
||||
"^\":position\" # Apunta a la posición de este objeto.\n"
|
||||
"^\":position:x\" # Apunta a la posición de este objeto en el eje x.\n"
|
||||
"^\"Camera3D:rotation:y\" # Apunta a la cámara secundaria Camera3D y su "
|
||||
"rotación y.\n"
|
||||
"^\"/root:size:x\" # Apunta a la ventana raíz y su ancho.\n"
|
||||
"[/codeblock]\n"
|
||||
"En algunas situaciones, es posible omitir el prefijo [code]:[/code] inicial "
|
||||
"cuando se apunta a la propiedad de un objeto. Como ejemplo, este es el caso "
|
||||
"de [method Object.set_indexed] y [method Tween.tween_property], ya que esos "
|
||||
"métodos llaman a [method NodePath.get_as_property_path] en segundo plano. Sin "
|
||||
"embargo, generalmente se recomienda mantener el prefijo [code]:[/code].\n"
|
||||
"Las rutas de nodos no pueden comprobar si son válidas y pueden apuntar a "
|
||||
"nodos o propiedades que no existen. Su significado depende completamente del "
|
||||
"contexto en el que se utilizan.\n"
|
||||
"Normalmente no hay que preocuparse por el tipo [NodePath], ya que las cadenas "
|
||||
"se convierten automáticamente al tipo cuando es necesario. Aún hay ocasiones "
|
||||
"en las que definir rutas de nodos es útil. Por ejemplo, las propiedades "
|
||||
"[NodePath] exportadas permiten seleccionar fácilmente cualquier nodo dentro "
|
||||
"de la escena que se está editando actualmente. También se actualizan "
|
||||
"automáticamente al mover, renombrar o eliminar nodos en el editor del árbol "
|
||||
"de escenas. Consulte también [anotación @GDScript.@export_node_path].\n"
|
||||
"Consulte también [StringName], que es un tipo similar diseñado para cadenas "
|
||||
"optimizadas.\n"
|
||||
"[b]Nota:[/b] En un contexto booleano, un [NodePath] se evaluará como "
|
||||
"[code]false[/code] si está vacío ([code]NodePath(\"\")[/code]). De lo "
|
||||
"contrario, un [NodePath] siempre se evaluará como [code]true[/code]."
|
||||
|
||||
msgid ""
|
||||
"If [code]true[/code], the resulting texture contains a normal map created "
|
||||
"from the original noise interpreted as a bump map."
|
||||
@@ -12495,6 +12643,360 @@ msgstr ""
|
||||
msgid "Object notifications"
|
||||
msgstr "Notificaciones de objeto"
|
||||
|
||||
msgid ""
|
||||
"Connects a [param signal] by name to a [param callable]. Optional [param "
|
||||
"flags] can be also added to configure the connection's behavior (see [enum "
|
||||
"ConnectFlags] constants).\n"
|
||||
"A signal can only be connected once to the same [Callable]. If the signal is "
|
||||
"already connected, this method returns [constant ERR_INVALID_PARAMETER] and "
|
||||
"pushes an error message, unless the signal is connected with [constant "
|
||||
"CONNECT_REFERENCE_COUNTED]. To prevent this, use [method is_connected] first "
|
||||
"to check for existing connections.\n"
|
||||
"If the [param callable]'s object is freed, the connection will be lost.\n"
|
||||
"[b]Examples with recommended syntax:[/b]\n"
|
||||
"Connecting signals is one of the most common operations in Godot and the API "
|
||||
"gives many options to do so, which are described further down. The code block "
|
||||
"below shows the recommended approach.\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"func _ready():\n"
|
||||
" var button = Button.new()\n"
|
||||
" # `button_down` here is a Signal variant type, and we thus call the "
|
||||
"Signal.connect() method, not Object.connect().\n"
|
||||
" # See discussion below for a more in-depth overview of the API.\n"
|
||||
" button.button_down.connect(_on_button_down)\n"
|
||||
"\n"
|
||||
" # This assumes that a `Player` class exists, which defines a `hit` "
|
||||
"signal.\n"
|
||||
" var player = Player.new()\n"
|
||||
" # We use Signal.connect() again, and we also use the Callable.bind() "
|
||||
"method,\n"
|
||||
" # which returns a new Callable with the parameter binds.\n"
|
||||
" player.hit.connect(_on_player_hit.bind(\"sword\", 100))\n"
|
||||
"\n"
|
||||
"func _on_button_down():\n"
|
||||
" print(\"Button down!\")\n"
|
||||
"\n"
|
||||
"func _on_player_hit(weapon_type, damage):\n"
|
||||
" print(\"Hit with weapon %s for %d damage.\" % [weapon_type, damage])\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"public override void _Ready()\n"
|
||||
"{\n"
|
||||
" var button = new Button();\n"
|
||||
" // C# supports passing signals as events, so we can use this idiomatic "
|
||||
"construct:\n"
|
||||
" button.ButtonDown += OnButtonDown;\n"
|
||||
"\n"
|
||||
" // This assumes that a `Player` class exists, which defines a `Hit` "
|
||||
"signal.\n"
|
||||
" var player = new Player();\n"
|
||||
" // We can use lambdas when we need to bind additional parameters.\n"
|
||||
" player.Hit += () => OnPlayerHit(\"sword\", 100);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"private void OnButtonDown()\n"
|
||||
"{\n"
|
||||
" GD.Print(\"Button down!\");\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"private void OnPlayerHit(string weaponType, int damage)\n"
|
||||
"{\n"
|
||||
" GD.Print($\"Hit with weapon {weaponType} for {damage} damage.\");\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"[b][code skip-lint]Object.connect()[/code] or [code skip-lint]Signal.connect()"
|
||||
"[/code]?[/b]\n"
|
||||
"As seen above, the recommended method to connect signals is not [method "
|
||||
"Object.connect]. The code block below shows the four options for connecting "
|
||||
"signals, using either this legacy method or the recommended [method Signal."
|
||||
"connect], and using either an implicit [Callable] or a manually defined one.\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"func _ready():\n"
|
||||
" var button = Button.new()\n"
|
||||
" # Option 1: Object.connect() with an implicit Callable for the defined "
|
||||
"function.\n"
|
||||
" button.connect(\"button_down\", _on_button_down)\n"
|
||||
" # Option 2: Object.connect() with a constructed Callable using a target "
|
||||
"object and method name.\n"
|
||||
" button.connect(\"button_down\", Callable(self, \"_on_button_down\"))\n"
|
||||
" # Option 3: Signal.connect() with an implicit Callable for the defined "
|
||||
"function.\n"
|
||||
" button.button_down.connect(_on_button_down)\n"
|
||||
" # Option 4: Signal.connect() with a constructed Callable using a target "
|
||||
"object and method name.\n"
|
||||
" button.button_down.connect(Callable(self, \"_on_button_down\"))\n"
|
||||
"\n"
|
||||
"func _on_button_down():\n"
|
||||
" print(\"Button down!\")\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"public override void _Ready()\n"
|
||||
"{\n"
|
||||
" var button = new Button();\n"
|
||||
" // Option 1: In C#, we can use signals as events and connect with this "
|
||||
"idiomatic syntax:\n"
|
||||
" button.ButtonDown += OnButtonDown;\n"
|
||||
" // Option 2: GodotObject.Connect() with a constructed Callable from a "
|
||||
"method group.\n"
|
||||
" button.Connect(Button.SignalName.ButtonDown, Callable."
|
||||
"From(OnButtonDown));\n"
|
||||
" // Option 3: GodotObject.Connect() with a constructed Callable using a "
|
||||
"target object and method name.\n"
|
||||
" button.Connect(Button.SignalName.ButtonDown, new Callable(this, "
|
||||
"MethodName.OnButtonDown));\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"private void OnButtonDown()\n"
|
||||
"{\n"
|
||||
" GD.Print(\"Button down!\");\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"While all options have the same outcome ([code]button[/code]'s [signal "
|
||||
"BaseButton.button_down] signal will be connected to [code]_on_button_down[/"
|
||||
"code]), [b]option 3[/b] offers the best validation: it will print a compile-"
|
||||
"time error if either the [code]button_down[/code] [Signal] or the "
|
||||
"[code]_on_button_down[/code] [Callable] are not defined. On the other hand, "
|
||||
"[b]option 2[/b] only relies on string names and will only be able to validate "
|
||||
"either names at runtime: it will print a runtime error if "
|
||||
"[code]\"button_down\"[/code] doesn't correspond to a signal, or if "
|
||||
"[code]\"_on_button_down\"[/code] is not a registered method in the object "
|
||||
"[code]self[/code]. The main reason for using options 1, 2, or 4 would be if "
|
||||
"you actually need to use strings (e.g. to connect signals programmatically "
|
||||
"based on strings read from a configuration file). Otherwise, option 3 is the "
|
||||
"recommended (and fastest) method.\n"
|
||||
"[b]Binding and passing parameters:[/b]\n"
|
||||
"The syntax to bind parameters is through [method Callable.bind], which "
|
||||
"returns a copy of the [Callable] with its parameters bound.\n"
|
||||
"When calling [method emit_signal] or [method Signal.emit], the signal "
|
||||
"parameters can be also passed. The examples below show the relationship "
|
||||
"between these signal parameters and bound parameters.\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"func _ready():\n"
|
||||
" # This assumes that a `Player` class exists, which defines a `hit` "
|
||||
"signal.\n"
|
||||
" var player = Player.new()\n"
|
||||
" # Using Callable.bind().\n"
|
||||
" player.hit.connect(_on_player_hit.bind(\"sword\", 100))\n"
|
||||
"\n"
|
||||
" # Parameters added when emitting the signal are passed first.\n"
|
||||
" player.hit.emit(\"Dark lord\", 5)\n"
|
||||
"\n"
|
||||
"# We pass two arguments when emitting (`hit_by`, `level`),\n"
|
||||
"# and bind two more arguments when connecting (`weapon_type`, `damage`).\n"
|
||||
"func _on_player_hit(hit_by, level, weapon_type, damage):\n"
|
||||
" print(\"Hit by %s (level %d) with weapon %s for %d damage.\" % [hit_by, "
|
||||
"level, weapon_type, damage])\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"public override void _Ready()\n"
|
||||
"{\n"
|
||||
" // This assumes that a `Player` class exists, which defines a `Hit` "
|
||||
"signal.\n"
|
||||
" var player = new Player();\n"
|
||||
" // Using lambda expressions that create a closure that captures the "
|
||||
"additional parameters.\n"
|
||||
" // The lambda only receives the parameters defined by the signal's "
|
||||
"delegate.\n"
|
||||
" player.Hit += (hitBy, level) => OnPlayerHit(hitBy, level, \"sword\", "
|
||||
"100);\n"
|
||||
"\n"
|
||||
" // Parameters added when emitting the signal are passed first.\n"
|
||||
" player.EmitSignal(SignalName.Hit, \"Dark lord\", 5);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// We pass two arguments when emitting (`hit_by`, `level`),\n"
|
||||
"// and bind two more arguments when connecting (`weapon_type`, `damage`).\n"
|
||||
"private void OnPlayerHit(string hitBy, int level, string weaponType, int "
|
||||
"damage)\n"
|
||||
"{\n"
|
||||
" GD.Print($\"Hit by {hitBy} (level {level}) with weapon {weaponType} for "
|
||||
"{damage} damage.\");\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]"
|
||||
msgstr ""
|
||||
"Conecta una señal [param signal] por nombre a una función [param callable]. "
|
||||
"También se pueden agregar indicadores [param flags] opcionales para "
|
||||
"configurar el comportamiento de la conexión (consulte las constantes [enum "
|
||||
"ConnectFlags]).\n"
|
||||
"Una señal solo se puede conectar una vez al mismo [Callable]. Si la señal ya "
|
||||
"está conectada, este método devuelve [constant ERR_INVALID_PARAMETER] y envía "
|
||||
"un mensaje de error, a menos que la señal esté conectada con [constant "
|
||||
"CONNECT_REFERENCE_COUNTED]. Para evitar esto, use primero [method "
|
||||
"is_connected] para verificar si existen conexiones.\n"
|
||||
"Si se libera el objeto del [param callable], se perderá la conexión.\n"
|
||||
"[b]Ejemplos con sintaxis recomendada:[/b]\n"
|
||||
"Conectar una señal es una de las operaciones más comunes en Godot y la API "
|
||||
"ofrece muchas opciones para hacerlo, que se describen más adelante. El bloque "
|
||||
"de código a continuación muestra el enfoque recomendado.\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"func _ready():\n"
|
||||
" var button = Button.new()\n"
|
||||
" # Aquí, `button_down` es un tipo de variante de Signal, y por lo tanto "
|
||||
"llamamos al método Signal.connect(), no a Object.connect().\n"
|
||||
" # Vea la discusión a continuación para obtener una descripción más "
|
||||
"detallada de la API.\n"
|
||||
" button.button_down.connect(_on_button_down)\n"
|
||||
"\n"
|
||||
" # Se asume que existe una clase `Player`, que define una señal `hit`.\n"
|
||||
" var player = Player.new()\n"
|
||||
" # Usamos Signal.connect() nuevamente, y también usamos el método Callable."
|
||||
"bind(),\n"
|
||||
" # que devuelve un nuevo Callable con el argumento vinculado.\n"
|
||||
" player.hit.connect(_on_player_hit.bind(\"sword\", 100))\n"
|
||||
"\n"
|
||||
"func _on_button_down():\n"
|
||||
" print(\"¡Botón abajo!\")\n"
|
||||
"\n"
|
||||
"func _on_player_hit(weapon_type, damage):\n"
|
||||
" print(\"Golpea con el arma %s con %d de daño.\" % [weapon_type, damage])\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"public override void _Ready()\n"
|
||||
"{\n"
|
||||
" var button = new Button();\n"
|
||||
" // C# admite el paso de señales como eventos, por lo que podemos usar "
|
||||
"esta construcción idiomática:\n"
|
||||
" button.ButtonDown += OnButtonDown;\n"
|
||||
"\n"
|
||||
" // Se asume que existe una clase `Player`, que define una señal `Hit`.\n"
|
||||
" var player = new Player();\n"
|
||||
" // Podemos usar lambdas cuando necesitamos vincular argumentos "
|
||||
"adicionales.\n"
|
||||
" player.Hit += () => OnPlayerHit(\"sword\", 100);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"private void OnButtonDown()\n"
|
||||
"{\n"
|
||||
" GD.Print(\"¡Botón abajo!\");\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"private void OnPlayerHit(string weaponType, int damage)\n"
|
||||
"{\n"
|
||||
" GD.Print($\"Golpea con el arma {weaponType} con {damage} de daño.\");\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"[b][code skip-lint]Object.connect()[/code] o [code skip-lint]Signal.connect()"
|
||||
"[/code]?[/b]\n"
|
||||
"Como se vio anteriormente, el método recomendado para conectar señales no es "
|
||||
"[method Object.connect]. El bloque de código a continuación muestra las "
|
||||
"cuatro opciones para conectar señales, ya sea usando este método heredado o "
|
||||
"el [method Signal.connect] recomendado, y usando un [Callable] implícito o "
|
||||
"uno definido manualmente.\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"func _ready():\n"
|
||||
" var button = Button.new()\n"
|
||||
" # Opción 1: Object.connect() con un Callable implícito para la función "
|
||||
"definida.\n"
|
||||
" button.connect(\"button_down\", _on_button_down)\n"
|
||||
" # Opción 2: Object.connect() con un Callable construido usando un objeto "
|
||||
"de destino y un nombre de método.\n"
|
||||
" button.connect(\"button_down\", Callable(self, \"_on_button_down\"))\n"
|
||||
" # Opción 3: Signal.connect() con un Callable implícito para la función "
|
||||
"definida.\n"
|
||||
" button.button_down.connect(_on_button_down)\n"
|
||||
" # Opción 4: Signal.connect() con un Callable construido usando un objeto "
|
||||
"de destino y un nombre de método.\n"
|
||||
" button.button_down.connect(Callable(self, \"_on_button_down\"))\n"
|
||||
"\n"
|
||||
"func _on_button_down():\n"
|
||||
" print(\"¡Botón abajo!\")\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"public override void _Ready()\n"
|
||||
"{\n"
|
||||
" var button = new Button();\n"
|
||||
" // Opción 1: En C#, podemos usar señales como eventos y conectarnos con "
|
||||
"esta sintaxis idiomática:\n"
|
||||
" button.ButtonDown += OnButtonDown;\n"
|
||||
" // Opción 2: GodotObject.Connect() con un Callable construido a partir de "
|
||||
"un grupo de métodos.\n"
|
||||
" button.Connect(Button.SignalName.ButtonDown, Callable."
|
||||
"From(OnButtonDown));\n"
|
||||
" // Opción 3: GodotObject.Connect() con un Callable construido usando un "
|
||||
"objeto de destino y un nombre de método.\n"
|
||||
" button.Connect(Button.SignalName.ButtonDown, new Callable(this, "
|
||||
"MethodName.OnButtonDown));\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"private void OnButtonDown()\n"
|
||||
"{\n"
|
||||
" GD.Print(\"¡Botón abajo!\");\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Si bien todas las opciones tienen el mismo resultado (la señal [signal "
|
||||
"BaseButton.button_down] de [code]button[/code] se conectará a "
|
||||
"[code]_on_button_down[/code]), la [b]opción 3[/b] ofrece la mejor validación: "
|
||||
"imprimirá un error en tiempo de compilación si no se definen [Signal] "
|
||||
"[code]button_down[/code] o [Callable] [code]_on_button_down[/code]. Por otro "
|
||||
"lado, la [b]opción 2[/b] solo depende de nombres de cadenas y solo se podrá "
|
||||
"validar el nombre en tiempo de ejecución: imprimirá un error de tiempo de "
|
||||
"ejecución si [code]\"button_down\"[/code] no corresponde a una señal, o si "
|
||||
"[code]\"_on_button_down\"[/code] no es un método registrado en el objeto "
|
||||
"[code]self[/code]. La razón principal para usar las opciones 1, 2 o 4 sería "
|
||||
"si realmente necesita usar cadenas (por ejemplo, para conectar señales "
|
||||
"programáticamente en función de las cadenas leídas de un archivo de "
|
||||
"configuración). De lo contrario, la opción 3 es el método recomendado (y más "
|
||||
"rápido).\n"
|
||||
"[b]Enlace y paso de parámetros:[/b]\n"
|
||||
"La sintaxis para enlazar parámetros es a través de [method Callable.bind], "
|
||||
"que devuelve una copia de [Callable] con sus parámetros vinculados.\n"
|
||||
"Al llamar a [method emit_signal] o [method Signal.emit], también se pueden "
|
||||
"pasar los argumentos de la señal. Los ejemplos a continuación muestran la "
|
||||
"relación entre estos argumentos de señal y los parámetros vinculados.\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"func _ready():\n"
|
||||
" # Se asume que existe una clase `Player`, que define una señal `hit`.\n"
|
||||
" var player = Player.new()\n"
|
||||
" # Uso de Callable.bind().\n"
|
||||
" player.hit.connect(_on_player_hit.bind(\"sword\", 100))\n"
|
||||
"\n"
|
||||
" # Los parámetros agregados al emitir la señal se pasan primero.\n"
|
||||
" player.hit.emit(\"Dark lord\", 5)\n"
|
||||
"\n"
|
||||
"# Pasamos dos argumentos al emitir (`hit_by`, `level`),\n"
|
||||
"# y vinculamos dos argumentos más al conectar (`weapon_type`, `damage`).\n"
|
||||
"func _on_player_hit(hit_by, level, weapon_type, damage):\n"
|
||||
" print(\"Golpeado por %s (nivel %d) con arma %s causando %d de daño.\" % "
|
||||
"[hit_by, level, weapon_type, damage])\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"public override void _Ready()\n"
|
||||
"{\n"
|
||||
" // Se asume que existe una clase `Player`, que define una señal `Hit`.\n"
|
||||
" var player = new Player();\n"
|
||||
" // Utilizando expresiones lambda que crean un cierre que captura los "
|
||||
"parámetros adicionales.\n"
|
||||
" // La lambda solo recibe los parámetros definidos por el delegado de la "
|
||||
"señal.\n"
|
||||
" player.Hit += (hitBy, level) => OnPlayerHit(hitBy, level, \"sword\", "
|
||||
"100);\n"
|
||||
" \n"
|
||||
" // Los parámetros añadidos al emitir la señal se pasan primero.\n"
|
||||
" player.EmitSignal(SignalName.Hit, \"Dark lord\", 5);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Pasamos dos argumentos al emitir (`hit_by`, `level`),\n"
|
||||
"// y vinculamos dos argumentos más al conectar (`weapon_type`, `damage`).\n"
|
||||
"private void OnPlayerHit(string hitBy, int level, string weaponType, int "
|
||||
"damage)\n"
|
||||
"{\n"
|
||||
" GD.Print($\"Golpeado por {hitBy} (level {level}) con arma {weaponType} "
|
||||
"causando {damage} de daño.\");\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]"
|
||||
|
||||
msgid ""
|
||||
"Returns [code]true[/code] if the [method Node.queue_free] method was called "
|
||||
"for the object."
|
||||
@@ -12797,6 +13299,15 @@ msgstr "El estilo del fondo de [PanelContainer]."
|
||||
msgid "A node used to create a parallax scrolling background."
|
||||
msgstr "Un nodo usado para crear un fondo de desplazamiento de paralaje."
|
||||
|
||||
msgid "2D Parallax"
|
||||
msgstr "Parallax 2D"
|
||||
|
||||
msgid ""
|
||||
"Velocity at which the offset scrolls automatically, in pixels per second."
|
||||
msgstr ""
|
||||
"Velocidad en la que el offset se desplaza automáticamente, en píxeles por "
|
||||
"segundo."
|
||||
|
||||
msgid "The base position offset for all [ParallaxLayer] children."
|
||||
msgstr ""
|
||||
"El dezplazamiento de la posición base para todos los [ParallaxLayer] hijos."
|
||||
@@ -12978,10 +13489,10 @@ msgid ""
|
||||
"of [PathFollow2D]). As such, the curve should usually start with a zero "
|
||||
"vector ([code](0, 0)[/code])."
|
||||
msgstr ""
|
||||
"Puede tener nodos infantiles [PathFollow2D] moviéndose a lo largo de la "
|
||||
"[Curve2D]. Vea [PathFollow2D] para más información sobre el uso.\n"
|
||||
"[b]Nota:[/b] La trayectoria se considera relativa a los nodos movidos (hijos "
|
||||
"de [PathFollow2D]). Como tal, la curva debería comenzar normalmente con un "
|
||||
"Puede tener nodos hijos [PathFollow2D] moviéndose a lo largo de la [Curve2D]. "
|
||||
"Vea [PathFollow2D] para más información sobre el uso.\n"
|
||||
"[b]Nota:[/b] El camino es considerado relativo a los nodos movidos (hijos de "
|
||||
"[PathFollow2D]). Como tal, la curva debería comenzar normalmente con un "
|
||||
"vector cero ([code](0, 0)[/code])."
|
||||
|
||||
msgid "A [Curve2D] describing the path."
|
||||
@@ -18095,6 +18606,286 @@ msgstr "Tipo de malla interna."
|
||||
msgid "Mesh type used internally for collision calculations."
|
||||
msgstr "Tipo de malla utilizada internamente para los cálculos de colisión."
|
||||
|
||||
msgid ""
|
||||
"Tweens are mostly useful for animations requiring a numerical property to be "
|
||||
"interpolated over a range of values. The name [i]tween[/i] comes from [i]in-"
|
||||
"betweening[/i], an animation technique where you specify [i]keyframes[/i] and "
|
||||
"the computer interpolates the frames that appear between them. Animating "
|
||||
"something with a [Tween] is called tweening.\n"
|
||||
"[Tween] is more suited than [AnimationPlayer] for animations where you don't "
|
||||
"know the final values in advance. For example, interpolating a dynamically-"
|
||||
"chosen camera zoom value is best done with a [Tween]; it would be difficult "
|
||||
"to do the same thing with an [AnimationPlayer] node. Tweens are also more "
|
||||
"light-weight than [AnimationPlayer], so they are very much suited for simple "
|
||||
"animations or general tasks that don't require visual tweaking provided by "
|
||||
"the editor. They can be used in a \"fire-and-forget\" manner for some logic "
|
||||
"that normally would be done by code. You can e.g. make something shoot "
|
||||
"periodically by using a looped [CallbackTweener] with a delay.\n"
|
||||
"A [Tween] can be created by using either [method SceneTree.create_tween] or "
|
||||
"[method Node.create_tween]. [Tween]s created manually (i.e. by using "
|
||||
"[code]Tween.new()[/code]) are invalid and can't be used for tweening values.\n"
|
||||
"A tween animation is created by adding [Tweener]s to the [Tween] object, "
|
||||
"using [method tween_property], [method tween_interval], [method "
|
||||
"tween_callback] or [method tween_method]:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = get_tree().create_tween()\n"
|
||||
"tween.tween_property($Sprite, \"modulate\", Color.RED, 1)\n"
|
||||
"tween.tween_property($Sprite, \"scale\", Vector2(), 1)\n"
|
||||
"tween.tween_callback($Sprite.queue_free)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"Tween tween = GetTree().CreateTween();\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"modulate\", Colors.Red, 1.0f);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"scale\", Vector2.Zero, 1.0f);\n"
|
||||
"tween.TweenCallback(Callable.From(GetNode(\"Sprite\").QueueFree));\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"This sequence will make the [code]$Sprite[/code] node turn red, then shrink, "
|
||||
"before finally calling [method Node.queue_free] to free the sprite. "
|
||||
"[Tweener]s are executed one after another by default. This behavior can be "
|
||||
"changed using [method parallel] and [method set_parallel].\n"
|
||||
"When a [Tweener] is created with one of the [code]tween_*[/code] methods, a "
|
||||
"chained method call can be used to tweak the properties of this [Tweener]. "
|
||||
"For example, if you want to set a different transition type in the above "
|
||||
"example, you can use [method set_trans]:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = get_tree().create_tween()\n"
|
||||
"tween.tween_property($Sprite, \"modulate\", Color.RED, 1).set_trans(Tween."
|
||||
"TRANS_SINE)\n"
|
||||
"tween.tween_property($Sprite, \"scale\", Vector2(), 1).set_trans(Tween."
|
||||
"TRANS_BOUNCE)\n"
|
||||
"tween.tween_callback($Sprite.queue_free)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"Tween tween = GetTree().CreateTween();\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"modulate\", Colors.Red, 1.0f)."
|
||||
"SetTrans(Tween.TransitionType.Sine);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"scale\", Vector2.Zero, 1.0f)."
|
||||
"SetTrans(Tween.TransitionType.Bounce);\n"
|
||||
"tween.TweenCallback(Callable.From(GetNode(\"Sprite\").QueueFree));\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Most of the [Tween] methods can be chained this way too. In the following "
|
||||
"example the [Tween] is bound to the running script's node and a default "
|
||||
"transition is set for its [Tweener]s:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = get_tree().create_tween().bind_node(self).set_trans(Tween."
|
||||
"TRANS_ELASTIC)\n"
|
||||
"tween.tween_property($Sprite, \"modulate\", Color.RED, 1)\n"
|
||||
"tween.tween_property($Sprite, \"scale\", Vector2(), 1)\n"
|
||||
"tween.tween_callback($Sprite.queue_free)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"var tween = GetTree().CreateTween().BindNode(this).SetTrans(Tween."
|
||||
"TransitionType.Elastic);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"modulate\", Colors.Red, 1.0f);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"scale\", Vector2.Zero, 1.0f);\n"
|
||||
"tween.TweenCallback(Callable.From(GetNode(\"Sprite\").QueueFree));\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Another interesting use for [Tween]s is animating arbitrary sets of objects:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = create_tween()\n"
|
||||
"for sprite in get_children():\n"
|
||||
" tween.tween_property(sprite, \"position\", Vector2(0, 0), 1)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"Tween tween = CreateTween();\n"
|
||||
"foreach (Node sprite in GetChildren())\n"
|
||||
" tween.TweenProperty(sprite, \"position\", Vector2.Zero, 1.0f);\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"In the example above, all children of a node are moved one after another to "
|
||||
"position (0, 0).\n"
|
||||
"You should avoid using more than one [Tween] per object's property. If two or "
|
||||
"more tweens animate one property at the same time, the last one created will "
|
||||
"take priority and assign the final value. If you want to interrupt and "
|
||||
"restart an animation, consider assigning the [Tween] to a variable:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween\n"
|
||||
"func animate():\n"
|
||||
" if tween:\n"
|
||||
" tween.kill() # Abort the previous animation.\n"
|
||||
" tween = create_tween()\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"private Tween _tween;\n"
|
||||
"\n"
|
||||
"public void Animate()\n"
|
||||
"{\n"
|
||||
" if (_tween != null)\n"
|
||||
" _tween.Kill(); // Abort the previous animation\n"
|
||||
" _tween = CreateTween();\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Some [Tweener]s use transitions and eases. The first accepts a [enum "
|
||||
"TransitionType] constant, and refers to the way the timing of the animation "
|
||||
"is handled (see [url=https://easings.net/]easings.net[/url] for some "
|
||||
"examples). The second accepts an [enum EaseType] constant, and controls where "
|
||||
"the [code]trans_type[/code] is applied to the interpolation (in the "
|
||||
"beginning, the end, or both). If you don't know which transition and easing "
|
||||
"to pick, you can try different [enum TransitionType] constants with [constant "
|
||||
"EASE_IN_OUT], and use the one that looks best.\n"
|
||||
"[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/"
|
||||
"tween_cheatsheet.webp]Tween easing and transition types cheatsheet[/url]\n"
|
||||
"[b]Note:[/b] Tweens are not designed to be re-used and trying to do so "
|
||||
"results in an undefined behavior. Create a new Tween for each animation and "
|
||||
"every time you replay an animation from start. Keep in mind that Tweens start "
|
||||
"immediately, so only create a Tween when you want to start animating.\n"
|
||||
"[b]Note:[/b] The tween is processed after all of the nodes in the current "
|
||||
"frame, i.e. node's [method Node._process] method would be called before the "
|
||||
"tween (or [method Node._physics_process] depending on the value passed to "
|
||||
"[method set_process_mode])."
|
||||
msgstr ""
|
||||
"Los interpoladores (tweens) son útiles principalmente para animaciones que "
|
||||
"requieren que se interpole una propiedad numérica en un rango de valores. El "
|
||||
"nombre [i]tween[/i] proviene de [i]in-betweening[/i], una técnica de "
|
||||
"animación en la que se especifican [i]frames clave[/i] y la computadora "
|
||||
"interpola los frame que aparecen entre ellos. Animar algo con un [Tween] se "
|
||||
"llama interpolación (tweening).\n"
|
||||
"Un [Tween] es más adecuado que [AnimationPlayer] para animaciones en las que "
|
||||
"no se conocen los valores finales de antemano. Por ejemplo, la interpolación "
|
||||
"de un valor de zoom de cámara elegido dinámicamente se realiza mejor con un "
|
||||
"[Tween]; sería difícil hacer lo mismo con un nodo [AnimationPlayer]. Los "
|
||||
"tweens también son más livianos que [AnimationPlayer], por lo que son muy "
|
||||
"adecuados para animaciones simples o tareas generales que no requieren "
|
||||
"ajustes visuales proporcionados por el editor. Se pueden utilizar de forma "
|
||||
"\"activar y olvidar\" para alguna lógica que normalmente se llevaría a cabo "
|
||||
"mediante código. Por ejemplo, se puede hacer que algo se active "
|
||||
"periódicamente mediante un [CallbackTweener] en bucle con un retraso.\n"
|
||||
"Se puede crear un [Tween] mediante el [method SceneTree.create_tween] o el "
|
||||
"[method Node.create_tween]. Los [Tween]s creados manualmente (es decir, "
|
||||
"mediante [code]Tween.new()[/code]) no son válidos y no se pueden utilizar "
|
||||
"para valores de interpolación.\n"
|
||||
"Una animación de interpolación se crea agregando [Tweener]s al objeto "
|
||||
"[Tween], utilizando [method tween_property], [method tween_interval], [method "
|
||||
"tween_callback] o [method tween_method]:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = get_tree().create_tween()\n"
|
||||
"tween.tween_property($Sprite, \"modulate\", Color.RED, 1)\n"
|
||||
"tween.tween_property($Sprite, \"scale\", Vector2(), 1)\n"
|
||||
"tween.tween_callback($Sprite.queue_free)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"Tween tween = GetTree().CreateTween();\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"modulate\", Colors.Red, 1.0f);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"scale\", Vector2.Zero, 1.0f);\n"
|
||||
"tween.TweenCallback(Callable.From(GetNode(\"Sprite\").QueueFree));\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Esta secuencia hará que el nodo [code]$Sprite[/code] se vuelva rojo, luego se "
|
||||
"encoja, antes de finalmente llamar al [method Node.queue_free] para liberar "
|
||||
"el sprite. Los [Tweener] se ejecutan uno tras otro de manera predeterminada. "
|
||||
"Este comportamiento se puede cambiar usando [method parallel] y [method "
|
||||
"set_parallel].\n"
|
||||
"Cuando se crea un [Tweener] con uno de los métodos [code]tween_*[/code], se "
|
||||
"puede usar una llamada de método encadenada para modificar las propiedades de "
|
||||
"este [Tweener]. Por ejemplo, si desea establecer un tipo de transición "
|
||||
"diferente en el ejemplo anterior, puede utilizar [method set_trans]:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = get_tree().create_tween()\n"
|
||||
"tween.tween_property($Sprite, \"modulate\", Color.RED, 1).set_trans(Tween."
|
||||
"TRANS_SINE)\n"
|
||||
"tween.tween_property($Sprite, \"scale\", Vector2(), 1).set_trans(Tween."
|
||||
"TRANS_BOUNCE)\n"
|
||||
"tween.tween_callback($Sprite.queue_free)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"Tween tween = GetTree().CreateTween();\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"modulate\", Colors.Red, 1.0f)."
|
||||
"SetTrans(Tween.TransitionType.Sine);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"scale\", Vector2.Zero, 1.0f)."
|
||||
"SetTrans(Tween.TransitionType.Bounce);\n"
|
||||
"tween.TweenCallback(Callable.From(GetNode(\"Sprite\").QueueFree));\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"La mayoría de los métodos [Tween] también se pueden encadenar de esta manera. "
|
||||
"En el siguiente ejemplo, el [Tween] está vinculado al nodo del script en "
|
||||
"ejecución y se establece una transición predeterminada para sus [Tweener]s:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = get_tree().create_tween().bind_node(self).set_trans(Tween."
|
||||
"TRANS_ELASTIC)\n"
|
||||
"tween.tween_property($Sprite, \"modulate\", Color.RED, 1)\n"
|
||||
"tween.tween_property($Sprite, \"scale\", Vector2(), 1)\n"
|
||||
"tween.tween_callback($Sprite.queue_free)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"var tween = GetTree().CreateTween().BindNode(this).SetTrans(Tween."
|
||||
"TransitionType.Elastic);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"modulate\", Colors.Red, 1.0f);\n"
|
||||
"tween.TweenProperty(GetNode(\"Sprite\"), \"scale\", Vector2.Zero, 1.0f);\n"
|
||||
"tween.TweenCallback(Callable.From(GetNode(\"Sprite\").QueueFree));\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Otro uso interesante de los [Tween] es animar conjuntos arbitrarios de "
|
||||
"objetos:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween = create_tween()\n"
|
||||
"for sprite in get_children():\n"
|
||||
" tween.tween_property(sprite, \"position\", Vector2(0, 0), 1)\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"Tween tween = CreateTween();\n"
|
||||
"foreach (Node sprite in GetChildren())\n"
|
||||
" tween.TweenProperty(sprite, \"position\", Vector2.Zero, 1.0f);\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"En el ejemplo anterior, todos los hijos de un nodo se mueven uno tras otro a "
|
||||
"la posición (0, 0).\n"
|
||||
"Debe evitar usar más de un [Tween] por propiedad del objeto. Si dos o más "
|
||||
"interpolaciones animan una propiedad al mismo tiempo, la última creada tendrá "
|
||||
"prioridad y asignará el valor final. Si desea interrumpir y reiniciar una "
|
||||
"animación, considere asignar el [Tween] a una variable:\n"
|
||||
"[codeblocks]\n"
|
||||
"[gdscript]\n"
|
||||
"var tween\n"
|
||||
"func animate():\n"
|
||||
" if tween:\n"
|
||||
" tween.kill() # Aborta la animación anterior.\n"
|
||||
" tween = create_tween()\n"
|
||||
"[/gdscript]\n"
|
||||
"[csharp]\n"
|
||||
"private Tween _tween;\n"
|
||||
"\n"
|
||||
"public void Animate()\n"
|
||||
"{\n"
|
||||
" if (_tween != null)\n"
|
||||
" _tween.Kill(); // Cancelar la animación anterior\n"
|
||||
" _tween = CreateTween();\n"
|
||||
"}\n"
|
||||
"[/csharp]\n"
|
||||
"[/codeblocks]\n"
|
||||
"Algunos [Tweener] usan transiciones y suavizados. El primero acepta una "
|
||||
"constante [enum TransitionType] y hace referencia a la forma en que se maneja "
|
||||
"el tiempo de la animación (consulte [url=https://easings.net/]easings.net[/"
|
||||
"url] para ver algunos ejemplos). El segundo acepta una constante [enum "
|
||||
"EaseType] y controla dónde se aplica el [code]trans_type[/code] a la "
|
||||
"interpolación (al principio, al final o en ambos). Si no sabe qué transición "
|
||||
"y suavizado elegir, puede probar diferentes constantes [enum TransitionType] "
|
||||
"con [constant EASE_IN_OUT] y usar la que se vea mejor.\n"
|
||||
"[url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/"
|
||||
"tween_cheatsheet.webp]Conjunto de trucos sobre tipos de transiciones y "
|
||||
"suavizado de interpolaciones[/url]\n"
|
||||
"[b]Nota:[/b] Las interpolaciones no están diseñadas para reutilizarse y, si "
|
||||
"se intenta hacerlo, se obtendrá un comportamiento indefinido. Crea una nueva "
|
||||
"interpolación para cada animación y cada vez que vuelvas a reproducir una "
|
||||
"animación desde el principio. Ten en cuenta que las interpolaciones comienzan "
|
||||
"inmediatamente, así que crea una sola cuando quieras empezar a animar.\n"
|
||||
"[b]Nota:[/b] La interpolación se procesa después de todos los nodos del frame "
|
||||
"actual, es decir, el método [method Node._process] del nodo se llamaría antes "
|
||||
"que la interpolación (o [method Node._physics_process], según el valor que se "
|
||||
"pase a [method set_process_mode])."
|
||||
|
||||
msgid "The animation is interpolated linearly."
|
||||
msgstr "La animación se interpola linealmente."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user