Skip to content

Feature/weather animations #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dojo/scripts/generate-content-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const config = {
shared_state: ["agent.py", "page.tsx", "style.css", "README.mdx"],
predictive_state_updates: ["agent.py", "page.tsx", "style.css", "README.mdx"],
tool_based_generative_ui: ["agent.py", "page.tsx", "style.css", "README.mdx"],
weather_animations: ["agent.py", "page.tsx", "style.css", "README.mdx"],
};

// Define which files should come from the feature directory vs. the demo directory
Expand Down
2 changes: 2 additions & 0 deletions dojo/src/app/api/copilotkit/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const humanInTheLoopAgent = new CustomAgent();
const predictiveStateUpdatesAgent = new CustomAgent();
const sharedStateAgent = new CustomAgent();
const toolBasedGenerativeUIAgent = new CustomAgent();
const weatherAnimationsAgent = new CustomAgent();

const runtime = new CopilotRuntime({
agents: {
Expand All @@ -23,6 +24,7 @@ const runtime = new CopilotRuntime({
predictiveStateUpdatesAgent,
sharedStateAgent,
toolBasedGenerativeUIAgent,
weatherAnimationsAgent,
},
});

Expand Down
166 changes: 166 additions & 0 deletions dojo/src/app/feature/weather_animations/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# ๐ŸŒฆ๏ธ Weather Animations - Dynamic UI Atmosphere

## What This Demo Shows

This demo showcases **dynamic weather animations** that respond to chat content and conversation context:

1. **Contextual Weather Changes**: The agent automatically detects weather mentions and mood in conversations
2. **Real-time Visual Effects**: Smooth animated transitions between different weather states
3. **Mood-based Atmosphere**: UI atmosphere changes based on emotional context
4. **Interactive Weather Control**: Direct weather manipulation through chat commands
5. **Immersive Experience**: Full-screen weather effects with backdrop-filtered UI elements

## ๐ŸŽฎ How to Interact

### Direct Weather Commands
Try asking the agent:
- **"Make it rain!"** - Triggers rain animation
- **"I want to see snow"** - Activates snowfall effect
- **"Create a storm"** - Brings dramatic storm with lightning
- **"Show me a beautiful sunset"** - Displays sunset atmosphere
- **"Make it a clear sunny day"** - Switches to clear sky
- **"I love windy weather"** - Activates wind particle effects
- **"It's getting cloudy"** - Shows moving cloud formations
- **"Make it nighttime"** - Switches to night mode with stars

### Mood-based Atmospheric Changes
The agent can also detect emotional context:
- **"I'm feeling sad today"** โ†’ Gentle rain
- **"I'm so excited!"** โ†’ Energetic wind effects
- **"I need to relax"** โ†’ Peaceful clouds
- **"This is dramatic!"** โ†’ Storm effects
- **"I'm happy!"** โ†’ Clear sunny weather
- **"Feeling mysterious"** โ†’ Night atmosphere
- **"So peaceful and calm"** โ†’ Sunset glow

### Intensity Control
Specify intensity levels:
- **"Light rain please"** โ†’ Gentle rain effect
- **"Heavy snowfall"** โ†’ Intense snow animation
- **"Dramatic storm"** โ†’ Full-intensity storm with lightning

## โšก Available Weather Effects

| Weather Type | Visual Effect | Intensity Levels |
|--------------|---------------|-------------------|
| **Clear** โ˜€๏ธ | Bright gradient sky | Light, Medium, Heavy |
| **Rain** ๐ŸŒง๏ธ | Animated raindrops | Light โ†’ Heavy downpour |
| **Snow** โ„๏ธ | Floating snowflakes | Light flurries โ†’ Heavy snowfall |
| **Wind** ๐Ÿ’จ | Moving particles | Gentle breeze โ†’ Strong gusts |
| **Clouds** โ˜๏ธ | Drifting cloud formations | Light cover โ†’ Overcast |
| **Storm** โ›ˆ๏ธ | Lightning + Rain | Light โ†’ Dramatic thunderstorm |
| **Sunset** ๐ŸŒ… | Warm color gradients | Soft glow โ†’ Vibrant colors |
| **Night** ๐ŸŒ™ | Stars + Moon | Calm โ†’ Twinkling sky |

## ๐Ÿ› ๏ธ Technical Implementation

### Agent Integration
```tsx
// Weather control action
useCopilotAction({
name: "change_weather",
description: "Change weather based on conversation context",
parameters: [
{ name: "weatherType", type: "string" },
{ name: "intensity", type: "string" },
{ name: "reason", type: "string" }
],
handler: ({ weatherType, intensity, reason }) => {
// Smooth transition to new weather state
setWeatherState({ type: weatherType, intensity });
}
});
```

### Mood Detection
```tsx
// Automatic mood-based atmosphere changes
useCopilotAction({
name: "detect_mood_weather",
description: "Auto-detect mood and change atmosphere",
parameters: [{ name: "mood", type: "string" }],
handler: ({ mood }) => {
// Map moods to weather states
const weather = moodWeatherMap[mood];
setWeatherState(weather);
}
});
```

### Animation System
- **CSS Keyframe Animations**: Smooth, performant weather effects
- **Dynamic Particle Systems**: Configurable rain, snow, and wind particles
- **Layered Rendering**: Background gradients + particle effects + UI content
- **Responsive Design**: Adapts to different screen sizes
- **Performance Optimized**: Uses `will-change` and reduced motion support

## ๐ŸŽจ Weather Animation Details

### Rain Effect
- Animated droplets falling from top to bottom
- Variable opacity and speed based on intensity
- Realistic raindrop shapes and gradients

### Snow Effect
- Rotating snowflake emojis with random trajectories
- Different sizes and fall speeds
- Gentle floating motion with wind drift

### Wind Effect
- Fast-moving particles across the screen
- Horizontal movement with slight vertical variation
- Speed increases with intensity

### Storm Effect
- Combined rain + lightning effects
- Periodic lightning flashes illuminating the screen
- Thunder bolt emojis with glow effects

### Cloud Effect
- Large emoji clouds drifting across the sky
- Different heights and speeds
- Opacity variation for depth

### Sunset/Night Effects
- Gradient background transitions
- Glowing sun/moon with pulse animation
- Twinkling stars with random timing

## ๐ŸŒŸ Advanced Features

### Smooth Transitions
- **Fade Effects**: Smooth opacity transitions between weather states
- **Blur Transitions**: Brief blur effect during weather changes
- **Background Morphing**: Gradient backgrounds smoothly shift colors

### Contextual Intelligence
- **Keyword Detection**: Agent recognizes weather and mood keywords
- **Emotional Analysis**: Maps emotions to appropriate atmospheric effects
- **Conversation Context**: Considers full conversation context for weather changes

### Visual Hierarchy
- **Layered Design**: Weather effects don't interfere with chat functionality
- **Backdrop Filters**: UI elements use glass-morphism effects
- **Adaptive Contrast**: Text remains readable in all weather conditions

## ๐Ÿ’ก Extension Ideas

This weather system can be extended with:
- **Seasonal Themes**: Spring, summer, autumn, winter variations
- **Location-based Weather**: Real weather data integration
- **Sound Effects**: Audio accompaniment for weather effects
- **Time-based Changes**: Automatic day/night cycles
- **Custom Weather**: User-created weather combinations
- **Weather Persistence**: Remember user's preferred weather
- **Interactive Elements**: Click-to-change weather hotspots

## ๐ŸŽฏ Use Cases

- **Mood Enhancement**: Create atmosphere matching conversation tone
- **Storytelling**: Visual accompaniment for narrative content
- **Meditation Apps**: Calming weather effects for relaxation
- **Gaming Interfaces**: Dynamic environmental effects
- **Presentation Tools**: Engaging visual backgrounds
- **Educational Content**: Weather system demonstrations

The weather animations create an **immersive, responsive environment** that makes conversations more engaging and emotionally resonant!
Loading