-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathanimator.html
More file actions
171 lines (150 loc) · 4.78 KB
/
animator.html
File metadata and controls
171 lines (150 loc) · 4.78 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Editor</title>
<style>
body {
margin: 0;
overflow: hidden;
font-family: sans-serif;
background: #333;
color: white;
}
#canvas-container {
width: 100vw;
height: 70vh;
background: #000;
}
#controls {
height: 30vh;
background: #222;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 10px;
}
.control-row {
display: flex;
gap: 20px;
align-items: center;
}
label {
min-width: 120px;
}
input[type="range"] {
flex-grow: 1;
}
button {
padding: 8px 16px;
cursor: pointer;
background: #4CAF50;
color: white;
border: none;
border-radius: 4px;
font-size: 14px;
}
button:hover {
background: #45a049;
}
button.secondary {
background: #555;
}
button.secondary:hover {
background: #666;
}
#timeline-viz {
width: 100%;
height: 120px;
background: #444;
position: relative;
margin-top: 10px;
border: 1px solid #666;
cursor: crosshair;
}
#profile-canvas {
width: 100%;
height: 100%;
display: block;
}
.keyframe-marker {
position: absolute;
width: 12px;
height: 12px;
background: #ffcc00;
border: 2px solid #fff;
border-radius: 50%;
cursor: move;
transform: translate(-50%, -50%);
z-index: 20;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
.keyframe-marker:hover {
background: #ff9900;
transform: translate(-50%, -50%) scale(1.2);
}
.current-marker {
position: absolute;
width: 2px;
height: 100%;
background: red;
top: 0;
pointer-events: none;
z-index: 15;
}
#instructions {
position: absolute;
top: 10px;
left: 10px;
background: rgba(0, 0, 0, 0.7);
padding: 10px;
pointer-events: none;
}
</style>
<!-- Three.js CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<!-- OrbitControls -->
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
</head>
<body>
<div id="instructions">
<h3>3D Editor</h3>
<p>1. Click on the profile bar to add points</p>
<p>2. Drag points to reshape the curve</p>
<p>3. Double-click a point to delete it</p>
<p>4. Use Play to preview animation</p>
<p>5. Export to generate Cam profile</p>
</div>
<div id="canvas-container"></div>
<div id="controls">
<div class="control-row">
<label for="cam-angle">Cam Angle (0-360°):</label>
<input type="range" id="cam-angle" min="0" max="360" value="0" step="1">
<span id="cam-angle-val">0°</span>
</div>
<div class="control-row">
<label for="follower-height">Follower Height:</label>
<input type="range" id="follower-height" min="0" max="100" value="0" step="1">
<span id="follower-height-val">0</span>
</div>
<div class="control-row">
<button id="btn-add-keyframe">Add Keyframe</button>
<button id="btn-play" class="secondary">Play Preview</button>
<button id="btn-clear" class="secondary">Clear All</button>
<label style="display: flex; align-items: center; gap: 5px; margin-left: 15px;">
<input type="checkbox" id="chk-smooth" checked>
<span>Smooth Curve</span>
</label>
<div style="flex-grow: 1;"></div>
<button id="btn-save-exit">Save & Return to Cam Generator</button>
</div>
<div id="timeline-viz">
<canvas id="profile-canvas"></canvas>
<div id="current-time-marker" class="current-marker"></div>
</div>
</div>
<script src="animator.js"></script>
</body>
</html>