-
Notifications
You must be signed in to change notification settings - Fork 12
/
3DEffect.swift
37 lines (34 loc) · 1.07 KB
/
3DEffect.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// ContentView.swift
// Examples
//
// Created by GrandSir on 19.09.2022.
//
import SwiftUI
import InteractiveMap
struct ContentView: View {
@State private var clickedPath = PathData()
var body: some View {
VStack {
Text(clickedPath.name.isEmpty ? "" : "\(clickedPath.name) is clicked!" )
.font(.largeTitle)
.padding(.bottom, 15)
InteractiveMap(svgName: "tr") { pathData in
InteractiveShape(from: pathData)
.initWithAttributes()
.shadow(color: clickedPath == pathData ? .white : .clear, radius: 6)
.onTapGesture {
clickedPath = pathData
}
.scaleEffect(clickedPath == pathData ? 1.4 : 1)
.animation(.easeInOut(duration: 0.2), value: clickedPath)
.zIndex(clickedPath == pathData ? 2 : 1)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}