create-template-html-css 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/README.md +165 -1
- package/bin/cli.js +27 -3
- package/package.json +16 -8
- package/src/generator.js +1 -1
- package/src/inserter.js +1 -1
- package/templates/animated-card/index.html +85 -0
- package/templates/animated-card/script.js +37 -0
- package/templates/animated-card/style.css +254 -0
- package/templates/dashboard-grid/index.html +247 -0
- package/templates/dashboard-grid/script.js +157 -0
- package/templates/dashboard-grid/style.css +558 -0
- package/templates/fade-gallery/index.html +134 -0
- package/templates/fade-gallery/script.js +123 -0
- package/templates/fade-gallery/style.css +309 -0
- package/templates/flex-cards/index.html +276 -0
- package/templates/flex-cards/script.js +122 -0
- package/templates/flex-cards/style.css +556 -0
- package/templates/flex-dashboard/index.html +282 -0
- package/templates/flex-dashboard/script.js +149 -0
- package/templates/flex-dashboard/style.css +659 -0
- package/templates/flex-layout/index.html +185 -0
- package/templates/flex-layout/script.js +79 -0
- package/templates/flex-layout/style.css +336 -0
- package/templates/grid-layout/index.html +164 -0
- package/templates/grid-layout/script.js +75 -0
- package/templates/grid-layout/style.css +452 -0
- package/templates/masonry-grid/index.html +196 -0
- package/templates/masonry-grid/script.js +122 -0
- package/templates/masonry-grid/style.css +259 -0
- package/templates/spinner/index.html +56 -0
- package/templates/spinner/script.js +22 -0
- package/templates/spinner/style.css +207 -0
- package/templates/typing-effect/index.html +58 -0
- package/templates/typing-effect/script.js +247 -0
- package/templates/typing-effect/style.css +253 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.4.0] - 2025-01-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Flexbox Layout Templates**:
|
|
12
|
+
- `flex-layout` - Comprehensive Flexbox patterns and examples (row, column, space-between, space-around, space-evenly, center, wrap, flex-grow, alignment variations, Holy Grail layout)
|
|
13
|
+
- `flex-cards` - Equal-height card layouts with Flexbox (pricing cards, product cards, team cards, testimonial cards with automatic equal heights and gradient backgrounds)
|
|
14
|
+
- `flex-dashboard` - Complete admin dashboard using Flexbox (collapsible sidebar, top bar with search, stats cards, bar chart, activity feed, top products, quick actions)
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Updated template count from 16 to 19 templates
|
|
18
|
+
- Enhanced `generator.js` and `inserter.js` with 3 new Flexbox components
|
|
19
|
+
- Updated CLI choices in `bin/cli.js` with Flexbox templates
|
|
20
|
+
- Enhanced `list` command to show new Flexbox category
|
|
21
|
+
- Updated README.md with detailed Flexbox template documentation
|
|
22
|
+
- Added `flexbox`, `flex-layout`, and `flex-dashboard` keywords to package.json
|
|
23
|
+
|
|
24
|
+
### Technical Details
|
|
25
|
+
- All Flexbox templates include full HTML, CSS, and JavaScript implementations
|
|
26
|
+
- Interactive sidebar collapse functionality
|
|
27
|
+
- Responsive design using pure Flexbox (no CSS Grid)
|
|
28
|
+
- Modern animations and hover effects
|
|
29
|
+
- Equal-height card systems without hacks
|
|
30
|
+
- Professional dashboard layouts with Flexbox
|
|
31
|
+
|
|
32
|
+
## [1.3.0] - 2025-01-18
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- **Animation Templates**:
|
|
36
|
+
- `spinner` - 5 loading spinner variations (circle, dots, pulse, bars, gradient)
|
|
37
|
+
- `animated-card` - 6 animated card types with flip, glow, slide, scale, tilt, and gradient effects
|
|
38
|
+
- `typing-effect` - Multiple text typing animations with rotating text and code typing
|
|
39
|
+
- `fade-gallery` - Image gallery with fade-in animations, masonry layout, and parallax effects
|
|
40
|
+
|
|
41
|
+
- **Grid Layout Templates**:
|
|
42
|
+
- `grid-layout` - 4 CSS Grid examples (basic, feature, auto-fit, complex)
|
|
43
|
+
- `masonry-grid` - Pinterest-style layout with filtering and category tags
|
|
44
|
+
- `dashboard-grid` - Complete admin dashboard with sidebar, widgets, and charts
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
- Updated `generator.js` and `inserter.js` with new template components
|
|
48
|
+
- Enhanced README.md with detailed descriptions of all 16 templates
|
|
49
|
+
- Updated feature list from 9 to 16 templates
|
|
50
|
+
|
|
51
|
+
### Technical Details
|
|
52
|
+
- All new templates include full HTML, CSS, and JavaScript implementations
|
|
53
|
+
- Responsive design support across all new components
|
|
54
|
+
- Modern animations using CSS keyframes and transforms
|
|
55
|
+
- Interactive features with vanilla JavaScript
|
|
56
|
+
- Security validation maintained for all new components
|
|
57
|
+
|
|
58
|
+
## [1.2.2] - Previous Version
|
|
59
|
+
|
|
60
|
+
### Initial Release
|
|
61
|
+
- Button, Card, Form, Navigation, Modal, Footer, Hero, Slider, Table templates
|
|
62
|
+
- CLI tool with create, insert, and list commands
|
|
63
|
+
- Security features: input validation, filename sanitization, path traversal protection
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ A powerful CLI library to create HTML+CSS element templates. Generate styled UI
|
|
|
26
26
|
- 🌈 **Stunning Gradients** - Colorful and attractive designs
|
|
27
27
|
- ⚡ **Animations** - Smooth and professional effects
|
|
28
28
|
- 🔧 **Customizable** - Easy to edit and modify the code
|
|
29
|
-
- 📦 **
|
|
29
|
+
- 📦 **19 Templates** - Button, Card, Form, Navigation, Modal, Footer, Hero, Slider, Table, Spinner, Animated Cards, Typing Effect, Fade Gallery, Grid Layouts, Masonry Grid, Dashboard, Flexbox Layouts
|
|
30
30
|
- 🎯 **Two Modes** - Create new projects or insert into existing HTML pages
|
|
31
31
|
- 🔒 **Secure** - Input validation and path protection
|
|
32
32
|
- 📚 **Well Documented** - Comprehensive guides and examples
|
|
@@ -298,6 +298,170 @@ Professional data table with advanced features:
|
|
|
298
298
|
- Page navigation
|
|
299
299
|
- Color-coded status indicators
|
|
300
300
|
|
|
301
|
+
### 10. Spinner 🔄
|
|
302
|
+
|
|
303
|
+
Animated loading spinners for various use cases:
|
|
304
|
+
|
|
305
|
+
**Variations:**
|
|
306
|
+
- Circle Spinner - Classic rotating circle
|
|
307
|
+
- Bouncing Dots - Three animated dots
|
|
308
|
+
- Pulse Loader - Pulsing effect
|
|
309
|
+
- Bar Loader - Dancing vertical bars
|
|
310
|
+
- Gradient Ring - Colorful rotating ring
|
|
311
|
+
|
|
312
|
+
**Features:**
|
|
313
|
+
- Pure CSS animations
|
|
314
|
+
- Smooth performance
|
|
315
|
+
- Multiple styles
|
|
316
|
+
- Easy customization
|
|
317
|
+
|
|
318
|
+
### 11. Animated Card ✨
|
|
319
|
+
|
|
320
|
+
Interactive card components with stunning animations:
|
|
321
|
+
|
|
322
|
+
**Variations:**
|
|
323
|
+
- Flip Card - 3D flip effect
|
|
324
|
+
- Glow Card - Animated glowing border
|
|
325
|
+
- Slide Card - Content slide animation
|
|
326
|
+
- Scale Card - Zoom with shadow
|
|
327
|
+
- Tilt Card - 3D tilt on hover
|
|
328
|
+
- Gradient Card - Animated background
|
|
329
|
+
|
|
330
|
+
**Features:**
|
|
331
|
+
- Advanced hover effects
|
|
332
|
+
- 3D transformations
|
|
333
|
+
- Interactive JavaScript
|
|
334
|
+
- Modern design patterns
|
|
335
|
+
|
|
336
|
+
### 12. Typing Effect ⌨️
|
|
337
|
+
|
|
338
|
+
Text animation components with typing effects:
|
|
339
|
+
|
|
340
|
+
**Variations:**
|
|
341
|
+
- Simple typing animation
|
|
342
|
+
- Multi-line typing
|
|
343
|
+
- Rotating text display
|
|
344
|
+
- Code typing effect
|
|
345
|
+
|
|
346
|
+
**Features:**
|
|
347
|
+
- Customizable speed
|
|
348
|
+
- Blinking cursor
|
|
349
|
+
- Multiple phrases
|
|
350
|
+
- Pause/restart controls
|
|
351
|
+
|
|
352
|
+
### 13. Fade Gallery 🖼️
|
|
353
|
+
|
|
354
|
+
Animated image gallery with scroll effects:
|
|
355
|
+
|
|
356
|
+
**Features:**
|
|
357
|
+
- Fade-in animations
|
|
358
|
+
- Hover overlays
|
|
359
|
+
- Horizontal scroll
|
|
360
|
+
- Parallax effect
|
|
361
|
+
- Intersection observer
|
|
362
|
+
- Responsive masonry layout
|
|
363
|
+
|
|
364
|
+
### 14. Grid Layout 📐
|
|
365
|
+
|
|
366
|
+
Comprehensive CSS Grid layouts:
|
|
367
|
+
|
|
368
|
+
**Includes:**
|
|
369
|
+
- Basic responsive grid
|
|
370
|
+
- Feature grid with hero item
|
|
371
|
+
- Auto-fit flexible grid
|
|
372
|
+
- Complex dashboard layout
|
|
373
|
+
|
|
374
|
+
**Features:**
|
|
375
|
+
- Modern CSS Grid
|
|
376
|
+
- Multiple grid patterns
|
|
377
|
+
- Animated items
|
|
378
|
+
- Fully responsive
|
|
379
|
+
|
|
380
|
+
### 15. Masonry Grid 🧱
|
|
381
|
+
|
|
382
|
+
Pinterest-style masonry layout:
|
|
383
|
+
|
|
384
|
+
**Features:**
|
|
385
|
+
- Column-based layout
|
|
386
|
+
- Category filtering
|
|
387
|
+
- Variable item heights
|
|
388
|
+
- Staggered animations
|
|
389
|
+
- Interactive likes
|
|
390
|
+
- 12 sample items
|
|
391
|
+
|
|
392
|
+
### 16. Dashboard Grid 📊
|
|
393
|
+
|
|
394
|
+
Complete admin dashboard template:
|
|
395
|
+
|
|
396
|
+
**Components:**
|
|
397
|
+
- Sidebar navigation
|
|
398
|
+
- Statistics cards
|
|
399
|
+
- Revenue chart
|
|
400
|
+
- Activity feed
|
|
401
|
+
- Product list
|
|
402
|
+
- Quick actions
|
|
403
|
+
|
|
404
|
+
**Features:**
|
|
405
|
+
- Full grid layout
|
|
406
|
+
- Real-time animations
|
|
407
|
+
- Mobile responsive
|
|
408
|
+
- Professional design
|
|
409
|
+
|
|
410
|
+
### 17. Flex Layout 📏
|
|
411
|
+
|
|
412
|
+
Comprehensive Flexbox patterns and examples:
|
|
413
|
+
|
|
414
|
+
**Includes:**
|
|
415
|
+
- Row and column layouts
|
|
416
|
+
- Space distribution patterns
|
|
417
|
+
- Alignment variations
|
|
418
|
+
- Flex-grow examples
|
|
419
|
+
- Nested flex containers
|
|
420
|
+
- Holy Grail layout
|
|
421
|
+
|
|
422
|
+
**Features:**
|
|
423
|
+
- Interactive examples
|
|
424
|
+
- Visual demonstrations
|
|
425
|
+
- Responsive design
|
|
426
|
+
- Modern Flexbox techniques
|
|
427
|
+
|
|
428
|
+
### 18. Flex Cards 🃏
|
|
429
|
+
|
|
430
|
+
Equal-height card layouts with Flexbox:
|
|
431
|
+
|
|
432
|
+
**Variations:**
|
|
433
|
+
- Basic equal-height cards
|
|
434
|
+
- Pricing cards
|
|
435
|
+
- Product cards
|
|
436
|
+
- Team member cards
|
|
437
|
+
- Testimonial cards
|
|
438
|
+
|
|
439
|
+
**Features:**
|
|
440
|
+
- Automatic equal heights
|
|
441
|
+
- Hover animations
|
|
442
|
+
- Gradient backgrounds
|
|
443
|
+
- Fully responsive
|
|
444
|
+
|
|
445
|
+
### 19. Flex Dashboard 🎛️
|
|
446
|
+
|
|
447
|
+
Admin dashboard built entirely with Flexbox:
|
|
448
|
+
|
|
449
|
+
**Components:**
|
|
450
|
+
- Collapsible sidebar
|
|
451
|
+
- Top search bar
|
|
452
|
+
- Stats cards
|
|
453
|
+
- Bar chart visualization
|
|
454
|
+
- Activity feed
|
|
455
|
+
- Top products list
|
|
456
|
+
- Quick actions
|
|
457
|
+
|
|
458
|
+
**Features:**
|
|
459
|
+
- Pure Flexbox layout
|
|
460
|
+
- Mobile responsive
|
|
461
|
+
- Interactive animations
|
|
462
|
+
- Professional design
|
|
463
|
+
|
|
464
|
+
|
|
301
465
|
## 💡 Examples
|
|
302
466
|
|
|
303
467
|
### Example 1: Create a Button Component
|
package/bin/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { program } = require('commander');
|
|
4
4
|
const inquirer = require('inquirer').default || require('inquirer');
|
|
@@ -30,7 +30,17 @@ program
|
|
|
30
30
|
{ name: 'Footer', value: 'footer' },
|
|
31
31
|
{ name: 'Hero Section', value: 'hero' },
|
|
32
32
|
{ name: 'Slider', value: 'slider' },
|
|
33
|
-
{ name: 'Table', value: 'table' }
|
|
33
|
+
{ name: 'Table', value: 'table' },
|
|
34
|
+
{ name: 'Spinner (Loading Animations)', value: 'spinner' },
|
|
35
|
+
{ name: 'Animated Card (Interactive Cards)', value: 'animated-card' },
|
|
36
|
+
{ name: 'Typing Effect (Text Animations)', value: 'typing-effect' },
|
|
37
|
+
{ name: 'Fade Gallery (Image Gallery)', value: 'fade-gallery' },
|
|
38
|
+
{ name: 'Grid Layout (CSS Grid)', value: 'grid-layout' },
|
|
39
|
+
{ name: 'Masonry Grid (Pinterest-style)', value: 'masonry-grid' },
|
|
40
|
+
{ name: 'Dashboard Grid (Admin Panel)', value: 'dashboard-grid' },
|
|
41
|
+
{ name: 'Flex Layout (Flexbox Patterns)', value: 'flex-layout' },
|
|
42
|
+
{ name: 'Flex Cards (Flexbox Cards)', value: 'flex-cards' },
|
|
43
|
+
{ name: 'Flex Dashboard (Flexbox Admin)', value: 'flex-dashboard' }
|
|
34
44
|
]
|
|
35
45
|
},
|
|
36
46
|
{
|
|
@@ -144,7 +154,8 @@ program
|
|
|
144
154
|
.command('list')
|
|
145
155
|
.description('List all available templates')
|
|
146
156
|
.action(() => {
|
|
147
|
-
console.log(chalk.blue('\
|
|
157
|
+
console.log(chalk.blue('\n📦 Available templates (19):\n'));
|
|
158
|
+
console.log(chalk.yellow('Basic Components:'));
|
|
148
159
|
console.log(' • Button - Styled button component');
|
|
149
160
|
console.log(' • Card - Card component with image and content');
|
|
150
161
|
console.log(' • Form - Form with input fields');
|
|
@@ -154,6 +165,19 @@ program
|
|
|
154
165
|
console.log(' • Hero - Hero section with CTA');
|
|
155
166
|
console.log(' • Slider - Image carousel with navigation');
|
|
156
167
|
console.log(' • Table - Data table with search and filtering');
|
|
168
|
+
console.log(chalk.yellow('\nAnimation Templates:'));
|
|
169
|
+
console.log(' • Spinner - 5 loading spinner variations');
|
|
170
|
+
console.log(' • Animated Card - 6 interactive card animations');
|
|
171
|
+
console.log(' • Typing Effect - Text typing animations');
|
|
172
|
+
console.log(' • Fade Gallery - Image gallery with fade effects');
|
|
173
|
+
console.log(chalk.yellow('\nGrid Layouts (CSS Grid):'));
|
|
174
|
+
console.log(' • Grid Layout - CSS Grid examples');
|
|
175
|
+
console.log(' • Masonry Grid - Pinterest-style layout');
|
|
176
|
+
console.log(' • Dashboard Grid - Complete admin dashboard');
|
|
177
|
+
console.log(chalk.yellow('\nFlexbox Layouts:'));
|
|
178
|
+
console.log(' • Flex Layout - Flexbox patterns and examples');
|
|
179
|
+
console.log(' • Flex Cards - Equal-height card layouts');
|
|
180
|
+
console.log(' • Flex Dashboard - Admin dashboard with Flexbox');
|
|
157
181
|
console.log('');
|
|
158
182
|
});
|
|
159
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-template-html-css",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "CLI tool to generate HTML and CSS templates for common UI elements",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,19 +18,27 @@
|
|
|
18
18
|
"template",
|
|
19
19
|
"html",
|
|
20
20
|
"css",
|
|
21
|
+
"javascript",
|
|
21
22
|
"generator",
|
|
22
23
|
"ui-components",
|
|
23
24
|
"html-template",
|
|
24
25
|
"css-template",
|
|
25
26
|
"component-generator",
|
|
26
27
|
"ui-generator",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
28
|
+
"animations",
|
|
29
|
+
"css-animations",
|
|
30
|
+
"css-grid",
|
|
31
|
+
"masonry",
|
|
32
|
+
"dashboard",
|
|
33
|
+
"spinner",
|
|
34
|
+
"loading",
|
|
35
|
+
"typing-effect",
|
|
36
|
+
"gallery",
|
|
37
|
+
"responsive",
|
|
38
|
+
"modern-ui",
|
|
39
|
+
"flexbox",
|
|
40
|
+
"flex-layout",
|
|
41
|
+
"flex-dashboard"
|
|
34
42
|
],
|
|
35
43
|
"author": "Ben Shabbat <benshabbat@example.com> (https://github.com/benshabbat)",
|
|
36
44
|
"license": "MIT",
|
package/src/generator.js
CHANGED
|
@@ -2,7 +2,7 @@ const fs = require('fs').promises;
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
4
|
// Security: Validate component name against whitelist
|
|
5
|
-
const VALID_COMPONENTS = ['button', 'card', 'form', 'navigation', 'modal', 'footer', 'hero', 'slider', 'table'];
|
|
5
|
+
const VALID_COMPONENTS = ['button', 'card', 'form', 'navigation', 'modal', 'footer', 'hero', 'slider', 'table', 'spinner', 'animated-card', 'typing-effect', 'fade-gallery', 'grid-layout', 'masonry-grid', 'dashboard-grid', 'flex-layout', 'flex-cards', 'flex-dashboard'];
|
|
6
6
|
|
|
7
7
|
// Security: Sanitize filename to prevent path traversal
|
|
8
8
|
function sanitizeFilename(filename) {
|
package/src/inserter.js
CHANGED
|
@@ -2,7 +2,7 @@ const fs = require('fs').promises;
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
4
|
// Security: Validate component name against whitelist
|
|
5
|
-
const VALID_COMPONENTS = ['button', 'card', 'form', 'navigation', 'modal', 'footer', 'hero', 'slider', 'table'];
|
|
5
|
+
const VALID_COMPONENTS = ['button', 'card', 'form', 'navigation', 'modal', 'footer', 'hero', 'slider', 'table', 'spinner', 'animated-card', 'typing-effect', 'fade-gallery', 'grid-layout', 'masonry-grid', 'dashboard-grid', 'flex-layout', 'flex-cards', 'flex-dashboard'];
|
|
6
6
|
|
|
7
7
|
async function insertComponent(options) {
|
|
8
8
|
const { component, targetFile, styleMode, scriptMode } = options;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>{{name}} - Animated Cards Component</title>
|
|
7
|
+
<link rel="stylesheet" href="style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<h1>Animated Cards Gallery</h1>
|
|
12
|
+
|
|
13
|
+
<div class="cards-grid">
|
|
14
|
+
<!-- Flip Card -->
|
|
15
|
+
<div class="card flip-card">
|
|
16
|
+
<div class="card-inner">
|
|
17
|
+
<div class="card-front">
|
|
18
|
+
<div class="icon">🎨</div>
|
|
19
|
+
<h3>Flip Card</h3>
|
|
20
|
+
<p>Hover to flip</p>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="card-back">
|
|
23
|
+
<h3>Amazing!</h3>
|
|
24
|
+
<p>This card flips with a smooth 3D animation effect</p>
|
|
25
|
+
<button class="btn">Learn More</button>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<!-- Glow Card -->
|
|
31
|
+
<div class="card glow-card">
|
|
32
|
+
<div class="card-content">
|
|
33
|
+
<div class="icon">✨</div>
|
|
34
|
+
<h3>Glow Effect</h3>
|
|
35
|
+
<p>Beautiful glowing border animation on hover</p>
|
|
36
|
+
<button class="btn">Explore</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Slide Card -->
|
|
41
|
+
<div class="card slide-card">
|
|
42
|
+
<div class="card-content">
|
|
43
|
+
<div class="icon">🚀</div>
|
|
44
|
+
<h3>Slide Up</h3>
|
|
45
|
+
<p>Content slides up with gradient overlay</p>
|
|
46
|
+
<button class="btn">Discover</button>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="slide-overlay"></div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<!-- Scale Card -->
|
|
52
|
+
<div class="card scale-card">
|
|
53
|
+
<div class="card-content">
|
|
54
|
+
<div class="icon">💎</div>
|
|
55
|
+
<h3>Scale Effect</h3>
|
|
56
|
+
<p>Smooth scaling with shadow depth</p>
|
|
57
|
+
<button class="btn">View More</button>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<!-- Tilt Card -->
|
|
62
|
+
<div class="card tilt-card">
|
|
63
|
+
<div class="card-content">
|
|
64
|
+
<div class="icon">🎯</div>
|
|
65
|
+
<h3>3D Tilt</h3>
|
|
66
|
+
<p>Interactive perspective transformation</p>
|
|
67
|
+
<button class="btn">Try It</button>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<!-- Gradient Card -->
|
|
72
|
+
<div class="card gradient-card">
|
|
73
|
+
<div class="card-content">
|
|
74
|
+
<div class="icon">🌈</div>
|
|
75
|
+
<h3>Gradient Shift</h3>
|
|
76
|
+
<p>Animated gradient background transition</p>
|
|
77
|
+
<button class="btn">See More</button>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<script src="script.js"></script>
|
|
84
|
+
</body>
|
|
85
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Animated Cards Component JavaScript
|
|
2
|
+
console.log('Animated Cards Component initialized');
|
|
3
|
+
|
|
4
|
+
// Add 3D tilt effect on mouse move for tilt card
|
|
5
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
6
|
+
const tiltCard = document.querySelector('.tilt-card');
|
|
7
|
+
|
|
8
|
+
if (tiltCard) {
|
|
9
|
+
tiltCard.addEventListener('mousemove', (e) => {
|
|
10
|
+
const rect = tiltCard.getBoundingClientRect();
|
|
11
|
+
const x = e.clientX - rect.left;
|
|
12
|
+
const y = e.clientY - rect.top;
|
|
13
|
+
|
|
14
|
+
const centerX = rect.width / 2;
|
|
15
|
+
const centerY = rect.height / 2;
|
|
16
|
+
|
|
17
|
+
const rotateX = (y - centerY) / 10;
|
|
18
|
+
const rotateY = (centerX - x) / 10;
|
|
19
|
+
|
|
20
|
+
tiltCard.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
tiltCard.addEventListener('mouseleave', () => {
|
|
24
|
+
tiltCard.style.transform = 'perspective(1000px) rotateX(0) rotateY(0)';
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Add click handlers to all buttons
|
|
29
|
+
const buttons = document.querySelectorAll('.btn');
|
|
30
|
+
buttons.forEach(btn => {
|
|
31
|
+
btn.addEventListener('click', (e) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
console.log('Button clicked:', btn.textContent);
|
|
34
|
+
// Add your custom action here
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|