WPF 按钮悬停动画效果实现

news2025/5/31 18:45:48

WPF 按钮悬停动画效果实现

下面我将实现一个专业的按钮悬停动画效果:当鼠标悬停在按钮上时,按钮上的文字由黑色变为白色,同时加粗并变大。

完整实现方案

MainWindow.xaml

<Window x:Class="ButtonHoverEffect.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ButtonHoverEffect"
        mc:Ignorable="d"
        Title="按钮悬停动画效果" 
        Height="400" 
        Width="600"
        WindowStartupLocation="CenterScreen"
        Background="#FF1E1E1E">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <!-- 标题 -->
        <TextBlock Text="专业按钮悬停动画效果" 
                   Grid.Row="0"
                   FontSize="28"
                   FontWeight="Bold"
                   Foreground="White"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Bottom"
                   Margin="0,0,0,40"/>
        
        <!-- 按钮容器 -->
        <StackPanel Grid.Row="1" 
                    Orientation="Horizontal" 
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Margin="20">
            
            <!-- 示例按钮 1 -->
            <Button Content="主页" 
                    Style="{StaticResource HoverButtonStyle}"
                    Margin="20,0"
                    Padding="30,15"/>
            
            <!-- 示例按钮 2 -->
            <Button Content="产品" 
                    Style="{StaticResource HoverButtonStyle}"
                    Margin="20,0"
                    Padding="30,15"/>
            
            <!-- 示例按钮 3 -->
            <Button Content="关于我们" 
                    Style="{StaticResource HoverButtonStyle}"
                    Margin="20,0"
                    Padding="30,15"/>
            
            <!-- 示例按钮 4 -->
            <Button Content="联系我们" 
                    Style="{StaticResource HoverButtonStyle}"
                    Margin="20,0"
                    Padding="30,15"/>
        </StackPanel>
        
        <!-- 页脚说明 -->
        <TextBlock Grid.Row="2"
                   Text="鼠标悬停在按钮上查看动画效果"
                   FontSize="16"
                   Foreground="#AAAAAA"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Top"
                   Margin="0,40,0,0"/>
    </Grid>
</Window>

App.xaml (添加全局样式)

<Application x:Class="ButtonHoverEffect.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <!-- 按钮悬停动画样式 -->
        <Style x:Key="HoverButtonStyle" TargetType="Button">
            <!-- 基本样式设置 -->
            <Setter Property="Background" Value="#FF252526"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="BorderBrush" Value="#FF3F3F46"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <!-- 按钮视觉结构 -->
                        <Border x:Name="border" 
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="8">
                            
                            <!-- 内容容器 -->
                            <ContentPresenter x:Name="contentPresenter"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              Margin="{TemplateBinding Padding}"/>
                        </Border>
                        
                        <!-- 触发器 -->
                        <ControlTemplate.Triggers>
                            <!-- 鼠标悬停触发器 -->
                            <Trigger Property="IsMouseOver" Value="True">
                                <!-- 文字颜色变为白色 -->
                                <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="White"/>
                                
                                <!-- 文字加粗 -->
                                <Setter TargetName="contentPresenter" Property="TextElement.FontWeight" Value="Bold"/>
                                
                                <!-- 文字变大 -->
                                <Setter TargetName="contentPresenter" Property="TextElement.FontSize" Value="20"/>
                                
                                <!-- 背景色变化 -->
                                <Setter Property="Background" Value="#FF4A90E2"/>
                                
                                <!-- 边框变化 -->
                                <Setter Property="BorderBrush" Value="#FF3A80D2"/>
                                
                                <!-- 阴影效果 -->
                                <Setter Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect BlurRadius="10" 
                                                          ShadowDepth="0" 
                                                          Color="#FF4A90E2" 
                                                          Opacity="0.7"/>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            
                            <!-- 鼠标按下效果 -->
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" Value="#FF2A70C2"/>
                                <Setter Property="BorderBrush" Value="#FF1A60B2"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <!-- 平滑动画版本 -->
        <Style x:Key="AnimatedHoverButtonStyle" TargetType="Button" BasedOn="{StaticResource HoverButtonStyle}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <!-- 按钮视觉结构 -->
                        <Border x:Name="border" 
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="8">
                            
                            <!-- 内容容器 -->
                            <ContentPresenter x:Name="contentPresenter"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              Margin="{TemplateBinding Padding}"/>
                        </Border>
                        
                        <!-- 触发器 -->
                        <ControlTemplate.Triggers>
                            <!-- 鼠标悬停触发器(带平滑动画) -->
                            <EventTrigger RoutedEvent="MouseEnter">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <!-- 文字颜色动画 -->
                                        <ColorAnimation Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
                                                         To="White"
                                                         Duration="0:0:0.3"/>
                                        
                                        <!-- 文字加粗动画(使用FontWeightConverter) -->
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter"
                                                                       Storyboard.TargetProperty="(TextElement.FontWeight)">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="Bold"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        
                                        <!-- 文字大小动画 -->
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(TextElement.FontSize)"
                                                         To="20"
                                                         Duration="0:0:0.3"/>
                                        
                                        <!-- 背景色动画 -->
                                        <ColorAnimation Storyboard.TargetName="border"
                                                        Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                        To="#FF4A90E2"
                                                        Duration="0:0:0.3"/>
                                        
                                        <!-- 边框色动画 -->
                                        <ColorAnimation Storyboard.TargetName="border"
                                                        Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
                                                        To="#FF3A80D2"
                                                        Duration="0:0:0.3"/>
                                        
                                        <!-- 阴影效果动画 -->
                                        <DoubleAnimation Storyboard.TargetProperty="Effect.(DropShadowEffect.Opacity)"
                                                         To="0.7"
                                                         Duration="0:0:0.3"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                            
                            <!-- 鼠标离开动画 -->
                            <EventTrigger RoutedEvent="MouseLeave">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <!-- 文字颜色恢复 -->
                                        <ColorAnimation Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
                                                         To="Black"
                                                         Duration="0:0:0.3"/>
                                        
                                        <!-- 文字加粗恢复 -->
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter"
                                                                       Storyboard.TargetProperty="(TextElement.FontWeight)">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="Normal"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        
                                        <!-- 文字大小恢复 -->
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter"
                                                         Storyboard.TargetProperty="(TextElement.FontSize)"
                                                         To="18"
                                                         Duration="0:0:0.3"/>
                                        
                                        <!-- 背景色恢复 -->
                                        <ColorAnimation Storyboard.TargetName="border"
                                                        Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                        To="#FF252526"
                                                        Duration="0:0:0.3"/>
                                        
                                        <!-- 边框色恢复 -->
                                        <ColorAnimation Storyboard.TargetName="border"
                                                        Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
                                                        To="#FF3F3F46"
                                                        Duration="0:0:0.3"/>
                                        
                                        <!-- 阴影效果恢复 -->
                                        <DoubleAnimation Storyboard.TargetProperty="Effect.(DropShadowEffect.Opacity)"
                                                         To="0"
                                                         Duration="0:0:0.3"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                            
                            <!-- 鼠标按下效果 -->
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" Value="#FF2A70C2"/>
                                <Setter Property="BorderBrush" Value="#FF1A60B2"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
</Application>

效果说明

基础效果(使用触发器)

  • 默认状态

    • 文字颜色:黑色
    • 字体粗细:正常
    • 字体大小:18
    • 背景色:深灰(#FF252526)
    • 边框色:深灰(#FF3F3F46)
  • 鼠标悬停状态

    • 文字颜色:白色
    • 字体粗细:加粗
    • 字体大小:20
    • 背景色:蓝色(#FF4A90E2)
    • 边框色:深蓝色(#FF3A80D2)
    • 添加蓝色阴影效果
  • 鼠标按下状态

    • 背景色:深蓝色(#FF2A70C2)
    • 边框色:更深蓝色(#FF1A60B2)

平滑动画效果(使用Storyboard动画)

  • 所有属性变化都有0.3秒的平滑过渡
  • 颜色变化使用ColorAnimation实现渐变
  • 字体大小变化使用DoubleAnimation实现平滑缩放
  • 字体粗细变化使用ObjectAnimationUsingKeyFrames实现

使用说明

1. 基本使用

<Button Content="基本按钮" 
        Style="{StaticResource HoverButtonStyle}"
        Padding="20,10"/>

2. 带平滑动画的按钮

<Button Content="平滑动画按钮" 
        Style="{StaticResource AnimatedHoverButtonStyle}"
        Padding="20,10"/>

3. 自定义按钮内容

<Button Style="{StaticResource AnimatedHoverButtonStyle}"
        Padding="20,10">
    <StackPanel Orientation="Horizontal" Spacing="10">
        <Path Data="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z" 
              Fill="Black" 
              Stretch="Uniform"
              Width="20"
              Height="20"/>
        <TextBlock Text="自定义内容" VerticalAlignment="Center"/>
    </StackPanel>
</Button>

高级效果:3D变换和光效

添加3D旋转效果

<!-- 在App.xaml的AnimatedHoverButtonStyle中添加 -->
<EventTrigger RoutedEvent="MouseEnter">
    <BeginStoryboard>
        <Storyboard>
            <!-- 其他动画... -->
            
            <!-- 3D旋转效果 -->
            <DoubleAnimation Storyboard.TargetName="transform3D"
                              Storyboard.TargetProperty="RotationX"
                              From="0" To="5" Duration="0:0:0.3"/>
            <DoubleAnimation Storyboard.TargetName="transform3D"
                              Storyboard.TargetProperty="RotationY"
                              From="0" To="5" Duration="0:0:0.3"/>
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="MouseLeave">
    <BeginStoryboard>
        <Storyboard>
            <!-- 其他动画... -->
            
            <!-- 3D旋转恢复 -->
            <DoubleAnimation Storyboard.TargetName="transform3D"
                              Storyboard.TargetProperty="RotationX"
                              To="0" Duration="0:0:0.3"/>
            <DoubleAnimation Storyboard.TargetName="transform3D"
                              Storyboard.TargetProperty="RotationY"
                              To="0" Duration="0:0:0.3"/>
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>

在按钮模板中添加3D变换:

<Border x:Name="border" ...>
    <Border.RenderTransform>
        <TransformGroup>
            <ScaleTransform/>
            <SkewTransform/>
            <RotateTransform/>
            <TranslateTransform/>
        </TransformGroup>
    </Border.RenderTransform>
    
    <Border.Projection>
        <PlaneProjection x:Name="transform3D"/>
    </Border.Projection>
    
    <ContentPresenter .../>
</Border>

添加光晕效果

<!-- 在按钮模板中添加 -->
<Border x:Name="glowEffect" 
        Opacity="0"
        Background="#60FFFFFF"
        CornerRadius="8"
        Margin="-5">
    <Border.Effect>
        <BlurEffect Radius="10"/>
    </Border.Effect>
</Border>

在动画中添加光晕效果:

<EventTrigger RoutedEvent="MouseEnter">
    <BeginStoryboard>
        <Storyboard>
            <!-- 其他动画... -->
            
            <!-- 光晕效果 -->
            <DoubleAnimation Storyboard.TargetName="glowEffect"
                              Storyboard.TargetProperty="Opacity"
                              To="1" Duration="0:0:0.3"/>
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="MouseLeave">
    <BeginStoryboard>
        <Storyboard>
            <!-- 其他动画... -->
            
            <!-- 光晕消失 -->
            <DoubleAnimation Storyboard.TargetName="glowEffect"
                              Storyboard.TargetProperty="Opacity"
                              To="0" Duration="0:0:0.3"/>
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>

专业建议

1. 性能优化

  • 使用硬件加速:

    // 在窗口构造函数中
    public MainWindow()
    {
        InitializeComponent();
        RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.Default;
    }
    
  • 简化动画元素:

    • 避免在动画中使用复杂效果
    • 限制同时进行的动画数量

2. 响应式设计

  • 使用Viewbox包裹按钮内容:
    <Button Style="{StaticResource AnimatedHoverButtonStyle}">
        <Viewbox>
            <TextBlock Text="响应式按钮"/>
        </Viewbox>
    </Button>
    

3. 主题支持

<Application.Resources>
    <!-- 主题颜色 -->
    <Color x:Key="PrimaryColor">#FF4A90E2</Color>
    <Color x:Key="PrimaryDarkColor">#FF3A80D2</Color>
    <Color x:Key="PrimaryDarkerColor">#FF2A70C2</Color>
    
    <!-- 在样式中使用主题颜色 -->
    <Style x:Key="HoverButtonStyle" TargetType="Button">
        <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
        <!-- 悬停时 -->
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="{StaticResource PrimaryDarkColor}"/>
        </Trigger>
    </Style>
</Application.Resources>

4. 无障碍支持

<Style TargetType="Button">
    <!-- 添加键盘焦点样式 -->
    <Setter Property="FocusVisualStyle">
        <Setter.Value>
            <Style>
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Rectangle Stroke="White" 
                                       StrokeThickness="2"
                                       StrokeDashArray="2 2"
                                       Margin="2"
                                       SnapsToDevicePixels="true"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>
    
    <!-- 高对比度支持 -->
    <Style.Triggers>
        <Trigger Property="SystemParameters.HighContrast" Value="true">
            <Setter Property="Background" Value="WindowText"/>
            <Setter Property="Foreground" Value="Window"/>
        </Trigger>
    </Style.Triggers>
</Style>

这个实现提供了专业且美观的按钮悬停动画效果,完全满足您的需求:鼠标悬停时文字颜色由黑变白、加粗并变大。您可以根据需要选择基本触发器效果或平滑动画效果,还可以添加额外的3D变换和光效来增强用户体验。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2391706.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

满天星之canvas实现【canvas】

展示 文章目录 展示Canvas 介绍【基础】简介兼容性关键特性注意事项应用场景&#xff1a;基本示例 满天星代码实现【重点】代码解释 全量代码【来吧&#xff0c;尽情复制吧少年】html引入JS代码 参考资源 Canvas 介绍【基础】 简介 Canvas是一个基于HTML5的绘图技术&#xff0…

【开源解析】基于PyQt5+Folium的谷歌地图应用开发:从入门到实战

&#x1f310;【开源解析】基于PyQt5Folium的谷歌地图应用开发&#xff1a;从入门到实战 &#x1f308; 个人主页&#xff1a;创客白泽 - CSDN博客 &#x1f525; 系列专栏&#xff1a;&#x1f40d;《Python开源项目实战》 &#x1f4a1; 热爱不止于代码&#xff0c;热情源自每…

在 Ubuntu 22.04 LTS 上离线安装 Docker

在 Ubuntu 22.04 LTS 上离线安装 Docker 一、准备工作 1.1 获取目标系统信息 在目标 Ubuntu 22.04 LTS 系统上&#xff0c;先执行以下命令确认架构信息&#xff1a; uname -m lsb_release -a一般返回如下信息&#xff1a; 1.2 需要一台可联网的机器 准备一台可以连接互联网…

python调用langchain实现RAG

一、安装langchain 安装依赖 python -m venv env.\env\Scripts\activatepip3 install langchainpip3 install langchain-corepip3 install langchain-openaipip3 install langchain-communitypip3 install dashscopepip3 install langchain_postgrespip3 install "psyc…

触控精灵 ADB运行模式填写电脑端IP教程

•ADB模式&#xff0c;如果你手机已经root则可以直接运行&#xff0c;无需安装电脑端。 •ADB模式&#xff0c;如果你手机没有root&#xff0c;那你可以windows电脑下载【极限投屏】软件&#xff0c;然后你的手机和电脑的网络要同一个wifi&#xff0c;然后把你电脑的ip地址填写…

uniapp|实现多端图片上传、拍照上传自定义插入水印内容及拖拽自定义水印位置,实现水印相机、图片下载保存等功能

本文以基础视角,详细讲解如何在uni-app中实现图片上传→水印动态编辑→图片下载的全流程功能。 目录 引言应用场景分析(社交媒体、内容保护、企业素材管理等)uniapp跨平台开发优势核心功能实现​图片上传模块多来源支持:相册选择(`uni.chooseImage`)与拍照(`sourceType:…

linux有效裁剪视频的方式(基于ffmpeg,不改变分辨率,帧率,视频质量,不需要三方软件)

就是在Linux上使用OBS Studio录制一个讲座或者其他视频&#xff0c;可能总有些时候会多录制一段时间&#xff0c;但是如果使用剪映或者PR这样的工具在导出的时候总需要烦恼导出的格式和参数&#xff0c;比如剪映就不支持mkv格式的导出&#xff0c;导出成mp4格式的视频就会变得很…

服务器密码安全运维解决新思路:凭据管理SMS+双因素SLA认证结合的方案

引言&#xff1a;云服务器安全成本困局 在云计算渗透率突破60%的今天&#xff0c;中小企业正面临严峻的安全悖论&#xff1a;某权威机构数据显示&#xff0c;72%的云上数据泄露事件源于凭据管理不当&#xff0c;而传统安全解决方案的采购成本往往超过中小企业年利润的8%。这种…

论文阅读笔记——In-Context Edit

ICEdit 论文阅读笔记 指令图像编辑现有方法的局限&#xff1a; 微调类方法&#xff08;InstructPix2Pix、Emu Edit、 Ultra Edit&#xff09;&#xff1a;需要大规模数据和算力、精度高但效率低且泛化性低&#xff1b;免训练方法&#xff08;Prompt-to-Prompt、 StableFlow&am…

【后端高阶面经:MongoDB篇】41、MongoDB 是怎么做到高可用的?

一、MongoDB高可用核心架构&#xff1a;副本集&#xff08;Replica Set&#xff09;设计 &#xff08;一&#xff09;副本集角色与拓扑结构 1. 三大核心角色 角色职责描述资源占用选举权重数据存储Primary唯一接收写请求的节点&#xff0c;将操作日志&#xff08;Oplog&…

DMBOK对比知识点整理(4)

1.常见数据质量维度 常见数据质量维度(DMBOK-P353)质量维度

day12 leetcode-hot100-21(矩阵4)

240. 搜索二维矩阵 II - 力扣&#xff08;LeetCode&#xff09; 1.暴力法O(m*n) 思路&#xff1a;两层for循环即可。 2.二分查找O(m*logn) 思路&#xff1a;每行都用二分查找,因为每行都是排好序的 class Solution {public boolean searchMatrix(int[][] matrix, int targe…

提问:鲜羊奶是解决育儿Bug的补丁吗?

在育儿这个"系统工程"中&#xff0c;过度提醒就像冗余代码&#xff1a;"快写作业"&#xff08;重复调用&#xff09;、"多穿衣服"&#xff08;异常捕获&#xff09;、"别玩手机"&#xff08;进程阻断&#xff09;。羊大师技术育儿实验…

关于数据仓库、数据湖、数据平台、数据中台和湖仓一体的概念和区别

我们谈论数据中台之前&#xff0c; 我们也听到过数据平台、数据仓库、数据湖、湖仓一体的相关概念&#xff0c;它们都与数据有关系&#xff0c;但他们和数据中台有什么样的区别&#xff0c; 下面我们将围绕数据平台、数据仓库、数据湖和数据中台的区别进行介绍。 一、相关概念…

什么是可重组机器人?

可重组机器人是一种具有高度灵活性和适应性的新型机器人系统&#xff0c;能够根据不同任务需求&#xff0c;快速改变自身结构和功能。下面我从概念、结构、特点、应用领域、发展趋势等方面&#xff0c;为你详细介绍&#xff1a; 概念&#xff1a;可重组机器人是由多个标准化、模…

4、docker compose

1、介绍 Docker Compose 是 Docker 官方提供的容器编排工具&#xff0c;用于简化多容器应用的开发、部署和管理。它通过声明式配置文件&#xff08;YAML格式&#xff09;定义容器化应用的服务、网络、存储等组件及其依赖关系&#xff0c;使用户能够通过单一命令快速启动、停止…

SQL里几种JOIN连接

数据信息&#xff1a; 员工表EMP 部门表DEPT 一、INNER JOIN&#xff08;内连接&#xff09; 作用&#xff1a;只返回两个表中完全匹配的行&#xff0c;相当于取交集。 场景&#xff1a;查询「有部门的员工信息」。 示例&#xff1a; SELECT 员工.姓名, 部门.部门名称 FR…

基于通义千问的儿童陪伴学习和成长的智能应用架构。

1.整体架构概览 我们的儿童聊天助手将采用典型的语音交互系统架构,结合大模型能力和外部知识库: 2. 技术方案分解 2.1. 前端应用/设备 选择: 移动App(iOS/Android)、Web应用,或者集成到智能音箱/平板等硬件设备中。技术栈: 移动App: React Native / Flutter (跨平台…

LVS-DR 负载均衡群集

目录 一、LVS-DR集群 1、LVS-DR 工作原理 2、数据包流向分析 3、LVS-DR 模式特点 二、直接路由模式&#xff08;LVS-DR&#xff09; 1、准备案例环境 2、配置负载调度器&#xff08;101&#xff09; &#xff08;1&#xff09;配置虚拟IP 地址&#xff08;VIP&#xff…

[Dify] 如何应对明道云API数据过长带来的Token超限问题

在集成明道云与大型语言模型(LLM)如ChatGPT或本地部署的Dify时,开发者经常会面临一个核心问题:API获取的数据太长,超出LLM支持的Token数限制,导致无法直接处理。本文将深入探讨这个问题的成因,并提供几种可行的解决方案,包括分段处理、外部知识库构建等策略。 明道云AP…