Доработка. Плавное смещение карты на текущие координаты
This commit is contained in:
@@ -21,11 +21,16 @@ class_name MercatorTileMap
|
||||
@export_range(0, 25, 1) var max_zoom_level: int = 19
|
||||
@export_range(0, 25, 1) var min_zoom_level: int = 0
|
||||
@export_color_no_alpha() var back_color: = Color.BLACK
|
||||
@export var animation_time: float = 1.0
|
||||
const default_size: = 400.0
|
||||
var is_centered: = false
|
||||
|
||||
|
||||
@export var animation_time: float = 0.1:
|
||||
set(val):
|
||||
animation_time = val
|
||||
$player.get_animation('goto').lenght = animation_time
|
||||
|
||||
|
||||
@export var size: Vector2i = Vector2i(default_size, default_size):
|
||||
set(v):
|
||||
$canvas.size = v
|
||||
@@ -652,17 +657,13 @@ func clear() -> void:
|
||||
|
||||
|
||||
func set_coordinates(lon: float, lat: float):
|
||||
var anim: Animation = $canvas/player.get_animation('goto')
|
||||
var wrld_pos = lonlat_to_world(lon, lat)
|
||||
|
||||
var anim: Animation = $player.get_animation('goto')
|
||||
var new_pos = lonlat_to_world(lon, lat)
|
||||
anim.track_insert_key(0, 0, _xyz.x)
|
||||
anim.track_insert_key(1, 0, _xyz.y)
|
||||
|
||||
anim.track_insert_key(0, animation_time, wrld_pos.x)
|
||||
anim.track_insert_key(1, animation_time, wrld_pos.y)
|
||||
|
||||
anim.length = animation_time
|
||||
$canvas/player.play('goto')
|
||||
anim.track_insert_key(0, animation_time, new_pos.x)
|
||||
anim.track_insert_key(1, animation_time, new_pos.y)
|
||||
$player.play('goto')
|
||||
|
||||
|
||||
func blend_mask(val: bool) -> void:
|
||||
|
||||
@@ -29,6 +29,7 @@ var shift_pressed: bool ## Кнопка SHIFT нажата.
|
||||
var strob_band_begin: float ## Ширина строба в момент начала перетаскивания.
|
||||
var strob_dir_begin: float ## Направление антенны в момент начала перетаскивания.
|
||||
var strob_width_begin: float ## Ширина строба по углу в момент начала перетаскивания.
|
||||
var is_anim_playng: = false
|
||||
|
||||
|
||||
signal drag_begin ## Вызывается в момент начала перетаскивания.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://b276iygic5itk"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://b276iygic5itk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://daudc0s3oox3i" path="res://scenes/работа/работа.gd" id="1_niok4"]
|
||||
[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip/bip.tscn" id="2_br3s6"]
|
||||
@@ -14,6 +14,38 @@
|
||||
[ext_resource type="Texture2D" uid="uid://0sk43ticjaxk" path="res://data/navi-center-0.png" id="12_5ffal"]
|
||||
[ext_resource type="Texture2D" uid="uid://bk4ssfho1murp" path="res://data/navi-center-1.png" id="13_ggrwd"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5ffal"]
|
||||
resource_name = "goto"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:ax")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:ay")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = false
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ggrwd"]
|
||||
_data = {
|
||||
&"goto": SubResource("Animation_5ffal")
|
||||
}
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cnr1s"]
|
||||
offsets = PackedFloat32Array(0.181818, 0.751623)
|
||||
colors = PackedColorArray(1, 1, 1, 0.352941, 1, 1, 1, 0)
|
||||
@@ -52,6 +84,11 @@ metadata/_edit_lock_ = true
|
||||
self_modulate = Color(1, 1, 1, 0.415686)
|
||||
position = Vector2(360, 360)
|
||||
|
||||
[node name="player" type="AnimationPlayer" parent="tilemap"]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_ggrwd")
|
||||
}
|
||||
|
||||
[node name="grd_side" parent="." instance=ExtResource("3_s2j0e")]
|
||||
layout_mode = 0
|
||||
offset_left = 1114.0
|
||||
|
||||
Reference in New Issue
Block a user