File size: 10,734 Bytes
f06ec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b726ba6
f06ec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b726ba6
f06ec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b726ba6
f06ec1c
 
 
b726ba6
f06ec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b726ba6
 
f06ec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b726ba6
 
 
 
 
 
 
 
f06ec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Animation Editor - Animate Studio Pro</title>
    <link rel="manifest" href="manifest.json">
    <meta name="theme-color" content="#3b82f6">
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-gray-900 text-white min-h-screen flex flex-col">
    <custom-navbar></custom-navbar>
    
    <main class="flex-grow container mx-auto px-4 py-8">
        <div class="flex justify-between items-center mb-8">
            <h1 class="text-3xl font-bold">Animation Editor</h1>
            <div class="flex gap-3">
                <button id="play-btn" class="btn-primary flex items-center gap-2">
                    <i data-feather="play"></i> Play
                </button>
                <button id="export-btn" class="btn-secondary flex items-center gap-2">
                    <i data-feather="download"></i> Export
                </button>
            </div>
        </div>
        
        <div class="flex flex-col lg:flex-row gap-6">
            <!-- Toolbar -->
            <div class="lg:w-16 flex flex-row lg:flex-col gap-2 overflow-x-auto lg:overflow-visible pb-4 lg:pb-0 toolbar">
                <button class="toolbar-btn tool-active" data-tool="select">
                    <i data-feather="mouse-pointer"></i>
                </button>
                <button class="toolbar-btn" data-tool="pen">
                    <i data-feather="pen-tool"></i>
                </button>
                <button class="toolbar-btn" data-tool="brush">
                    <i data-feather="brush"></i>
                </button>
                <button class="toolbar-btn" data-tool="eraser">
                    <i data-feather="minus-square"></i>
                </button>
                <button class="toolbar-btn" data-tool="shapes">
                    <i data-feather="square"></i>
                </button>
                <button class="toolbar-btn" data-tool="text">
                    <i data-feather="type"></i>
                </button>
                <button class="toolbar-btn" data-tool="fill">
                    <i data-feather="droplet"></i>
                </button>
            </div>
<!-- Canvas Area -->
            <div class="flex-grow">
                <div class="canvas-container p-4">
                    <div class="bg-gray-800 rounded-lg overflow-hidden" style="height: 500px;">
                        <canvas id="animation-canvas" class="w-full h-full"></canvas>
                    </div>
                    
                    <!-- Timeline -->
                    <div class="mt-6">
                        <div class="flex justify-between items-center mb-3">
                            <h3 class="font-semibold">Timeline</h3>
                            <div class="flex gap-2">
                                <button id="add-frame" class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm">
                                    + Frame
                                </button>
                                <button id="delete-frame" class="bg-gray-700 hover:bg-gray-600 px-3 py-1 rounded text-sm">
                                    - Frame
                                </button>
                            </div>
                        </div>
                        <div class="timeline-container overflow-x-auto pb-2">
                            <div class="flex h-16 bg-gray-700 rounded" id="timeline">
                                <!-- Frames will be added here dynamically -->
                            </div>
                        </div>
</div>
                </div>
            </div>
            
            <!-- Properties Panel -->
            <div class="lg:w-80">
                <div class="bg-gray-800 rounded-lg p-5">
                    <h3 class="font-bold text-lg mb-4">Properties</h3>
                    
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium mb-1">Canvas Size</label>
                            <div class="grid grid-cols-2 gap-2">
                                <input type="number" value="800" class="bg-gray-700 border border-gray-600 rounded px-3 py-2 w-full">
                                <input type="number" value="600" class="bg-gray-700 border border-gray-600 rounded px-3 py-2 w-full">
                            </div>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium mb-1">Frame Rate</label>
                            <select class="bg-gray-700 border border-gray-600 rounded px-3 py-2 w-full">
                                <option>12 fps</option>
                                <option selected>24 fps</option>
                                <option>30 fps</option>
                                <option>60 fps</option>
                            </select>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium mb-1">Background</label>
                            <div class="flex gap-2">
                                <input type="color" value="#1f2937" class="w-10 h-10 bg-gray-700 border border-gray-600 rounded cursor-pointer">
                                <input type="text" value="#1f2937" class="bg-gray-700 border border-gray-600 rounded px-3 py-2 flex-grow">
                            </div>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium mb-1">Brush Size</label>
                            <input type="range" min="1" max="50" value="5" class="w-full">
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium mb-1">Brush Color</label>
                            <div class="flex gap-2">
                                <input type="color" value="#3b82f6" class="w-10 h-10 bg-gray-700 border border-gray-600 rounded cursor-pointer">
                                <input type="text" value="#3b82f6" class="bg-gray-700 border border-gray-600 rounded px-3 py-2 flex-grow">
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-gray-800 rounded-lg p-5 mt-6">
                    <h3 class="font-bold text-lg mb-4">Layers</h3>
                    <div class="space-y-2">
                        <div class="flex items-center justify-between bg-gray-700 p-2 rounded">
                            <span>Layer 1</span>
                            <div class="flex gap-2">
                                <button class="text-gray-400 hover:text-white">
                                    <i data-feather="eye" class="w-4 h-4"></i>
                                </button>
                                <button class="text-gray-400 hover:text-white">
                                    <i data-feather="lock" class="w-4 h-4"></i>
                                </button>
                            </div>
                        </div>
                        <div class="flex items-center justify-between p-2 rounded">
                            <span class="text-gray-400">+ Add Layer</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
    
    <custom-footer></custom-footer>
    
    <script src="components/navbar.js"></script>
    <script src="components/footer.js"></script>
    <script src="script.js"></script>
    <script>
        // Initialize canvas
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            
            const canvas = document.getElementById('animation-canvas');
            const ctx = canvas.getContext('2d');
            
            // Set canvas size
            canvas.width = canvas.offsetWidth;
            canvas.height = canvas.offsetHeight;
            
            // Draw initial content
            ctx.fillStyle = '#1f2937';
            ctx.fillRect(0, 0, canvas.width, canvas.height);
            
            ctx.font = '20px Inter';
            ctx.fillStyle = '#9ca3af';
            ctx.textAlign = 'center';
            ctx.fillText('Start drawing your animation!', canvas.width/2, canvas.height/2);
            
            // Initialize timeline
            const timeline = document.getElementById('timeline');
            for (let i = 0; i < 10; i++) {
                const frame = document.createElement('div');
                frame.className = 'w-12 h-12 bg-gray-600 rounded m-2 cursor-pointer flex items-center justify-center relative';
                if (i === 0) {
                    frame.classList.add('bg-blue-500');
                }
                if (i % 3 === 0) {
                    frame.classList.add('ring-2', 'ring-yellow-500');
                }
                frame.innerHTML = `<span class="text-xs">${i+1}</span>`;
                timeline.appendChild(frame);
            }
            
            // Tool selection
            const toolButtons = document.querySelectorAll('[data-tool]');
            toolButtons.forEach(button => {
                button.addEventListener('click', function() {
                    toolButtons.forEach(btn => btn.classList.remove('tool-active'));
                    this.classList.add('tool-active');
                });
            });
            
            // Play button
            document.getElementById('play-btn').addEventListener('click', function() {
                const icon = this.querySelector('i');
                if (icon.getAttribute('data-feather') === 'play') {
                    icon.setAttribute('data-feather', 'pause');
                    feather.replace();
                } else {
                    icon.setAttribute('data-feather', 'play');
                    feather.replace();
                }
            });
            
            // Export button
            document.getElementById('export-btn').addEventListener('click', function() {
                alert('In a full implementation, this would export your animation as a video file.');
            });
        });
    </script>
</body>
</html>