首页 文章 精选 留言 我的

精选列表

搜索[模糊效果],共10000篇文章
优秀的个人博客,低调大师

DEMO:transition3d、运用动画实现图片3d翻转效果

模仿系统apiDemos里的范例,去掉了listview,修改为点击图片后,更新图片并播放3d翻转动画。 代码: 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 package com.example.aexh_11_transition3d; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.DecelerateInterpolator; import android.view.animation.Animation.AnimationListener; import android.widget.ImageView; public class MainActivity extends Activity implements OnClickListener { /** * 仿照系统的范例,修改成点击图片播放动画更新图片。 * apiDemos范例: com.example.android.apis.animation * Transition3d */ private static final int [] PHOTOS_RESOURCES = new int [] { R.drawable.photo1, R.drawable.photo2, R.drawable.photo3, R.drawable.photo4, R.drawable.photo5, R.drawable.photo6 }; private ImageView mImageview; private ViewGroup mLayout; private int mPosition; @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.activity_main); mImageview = (ImageView) findViewById(R.id.imageView1); mImageview.setOnClickListener( this ); mLayout = (ViewGroup) findViewById(R.id.image_layout); // ViewGroup是所有layout的父类 /** * 下面这句应该是用来压缩大图的,没加上这句运行正常 */ // Since we are caching large views, we want to keep their cache // between each animation mLayout.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE); } @Override public void onClick(View v) { if (v.getId() == R.id.imageView1) { // Pre-load the image then start the animation mPosition++; applyRotation( 0 , 90 ); mImageview.setImageResource(PHOTOS_RESOURCES[mPosition % 6 ]); } } /** * Setup a new 3D rotation on the container view. * * @param position * the item that was clicked to show a picture, or -1 to show the * list * @param start * the start angle at which the rotation must begin * @param end * the end angle of the rotation */ private void applyRotation( float start, float end) { // Find the center of the container final float centerX = mLayout.getWidth() / 2 .0f; final float centerY = mLayout.getHeight() / 2 .0f; // Create a new 3D rotation with the supplied parameter // The animation listener is used to trigger the next animation final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end, centerX, centerY, 310 .0f, true ); rotation.setDuration( 500 ); rotation.setFillAfter( true ); rotation.setInterpolator( new AccelerateInterpolator()); // 监听动画 rotation.setAnimationListener( new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mLayout.post(mAaction); // 刷新layout这个View } }); // 启动动画 mLayout.startAnimation(rotation); } Runnable mAaction = new Runnable() { @Override public void run() { final float centerX = mLayout.getWidth() / 2 .0f; final float centerY = mLayout.getHeight() / 2 .0f; Rotate3dAnimation rotation; // mImageView.requestFocus(); rotation = new Rotate3dAnimation( 90 , 180 , centerX, centerY, 310 .0f, false ); rotation.setDuration( 500 ); rotation.setFillAfter( true ); rotation.setInterpolator( new DecelerateInterpolator()); mLayout.startAnimation(rotation); } }; } 系统实现的动画方法: 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 package com.example.aexh_11_transition3d; /* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.view.animation.Animation; import android.view.animation.Transformation; import android.graphics.Camera; import android.graphics.Matrix; /** * An animation that rotates the view on the Y axis between two specified * angles. This animation also adds a translation on the Z axis (depth) to * improve the effect. */ public class Rotate3dAnimation extends Animation { private final float mFromDegrees; private final float mToDegrees; private final float mCenterX; private final float mCenterY; private final float mDepthZ; private final boolean mReverse; private Camera mCamera; /** * Creates a new 3D rotation on the Y axis. The rotation is defined by its * start angle and its end angle. Both angles are in degrees. The rotation * is performed around a center point on the 2D space, definied by a pair of * X and Y coordinates, called centerX and centerY. When the animation * starts, a translation on the Z axis (depth) is performed. The length of * the translation can be specified, as well as whether the translation * should be reversed in time. * * @param fromDegrees * the start angle of the 3D rotation * @param toDegrees * the end angle of the 3D rotation * @param centerX * the X center of the 3D rotation * @param centerY * the Y center of the 3D rotation * @param reverse * true if the translation should be reversed, false otherwise */ public Rotate3dAnimation( float fromDegrees, float toDegrees, float centerX, float centerY, float depthZ, boolean reverse) { mFromDegrees = fromDegrees; mToDegrees = toDegrees; mCenterX = centerX; mCenterY = centerY; mDepthZ = depthZ; mReverse = reverse; } @Override public void initialize( int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); mCamera = new Camera(); } @Override protected void applyTransformation( float interpolatedTime, Transformation t) { final float fromDegrees = mFromDegrees; float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime); final float centerX = mCenterX; final float centerY = mCenterY; final Camera camera = mCamera; final Matrix matrix = t.getMatrix(); camera.save(); if (mReverse) { camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime); } else { camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime)); } camera.rotateY(degrees); camera.getMatrix(matrix); camera.restore(); matrix.preTranslate(-centerX, -centerY); matrix.postTranslate(centerX, centerY); } } 本文转自 glblong 51CTO博客,原文链接:http://blog.51cto.com/glblong/1226205,如需转载请自行联系原作者

优秀的个人博客,低调大师

英伟达开源 2530 亿参数推理大模型,效果直逼 DeepSeek-R1

英伟达开源了NVIDIA Llama Nemotron中最大尺寸的推理模型 Llama-3.1-Nemotron-Ultra-253B-v1,可用于聊天机器人开发、AI Agent 工作流、检索增强生成(RAG)和代码生成等场景。 根据英伟达开放模型许可证及 Llama 3.1 社区许可协议,该模型已获准用于商业用途。 NVIDIA Llama Nemotron 是英伟达在上个月推出的一系列支持推理和多样化 Agent 任务的模型。该模型系列提供三种不同尺寸: Nano:8B,基于Llama 3.1 8B进行微调,适用于在个人电脑和边缘设备上实现最高精度。 Super:49B,从Llama 3.3 70B蒸馏而来,适用于在数据中心GPU上实现最高精度和最高吞吐量。 Ultra:253B,从Llama 3.1 405B蒸馏而来,适用于在多GPU数据中心服务器上实现最大智能代理精度。 当时英伟达只放出了 Nano 和 Super 两个模型版本,现在他们终于把最大的版本 Ultra 给开源了。 目前,该模型的代码已在 Hugging Face 平台上公开,包含开放的权重和训练后数据。 模型地址:https://huggingface.co/nvidia/Llama-3_1-Nemotron-Ultra-253B-v1 文档地址:https://docs.api.nvidia.com/nim/reference/nvidia-llama-3_1-nemotron-ultra-253b-v1 Llama-3.1-Nemotron-Ultra-253B-v1 是从 Meta Llama-3.1-405B-Instruct 蒸馏得到的。这是一个经过后训练的推理模型,专注于推理、人类聊天偏好以及诸如 RAG(检索增强生成)和工具调用等任务。该模型支持 128K 的上下文长度,并且可以在单个 8xH100 节点上进行推理。 据介绍,Llama-3.1-Nemotron-Ultra-253B 的设计目标是支持高级推理、指令遵循以及 AI 助手工作流程。技术特点如下: 采用神经架构搜索(NAS)优化架构 引入跳跃注意力层、融合前馈网络(FFN)和可变 FFN 压缩率 降低内存占用和计算需求,保持输出质量 可在单个 8x H100 GPU 节点高效部署 部署支持 B100 和 Hopper 微架构硬件 在 BF16 和 FP8 精度模式下均验证通过 Llama-3.1-Nemotron-Ultra-253B-v1 的训练包括模型蒸馏、SFT、面向推理的 RL 以及面向对齐的 RL 四个阶段。 特别地,区别于一些只支持推理的大模型,Ultra 模型支持通过系统提示词控制是否开启推理模式。 该模型基于 Meta 早期的 Llama-3.1-405B-Instruct 模型开发,拥有 2530 亿个参数,在多项第三方基准测试中表现出色: 值得关注的是,英伟达新模型的性能逼近拥有 6710 亿参数的 DeepSeek R1,但只用了不到一半的参数量。 测试结果显示,GPQA(76 vs. 71.5)、IFEval 指令遵循(89.5 vs. 88.8)和 LiveCodeBench 编码任务(66.3 vs. 65.9)。并且,Llama-3.1-Nemotron-Ultra-253B 推理吞吐量也比 DeepSeek R1 671B 高 4 倍。 但在 MATH500 和 Arena Hard 基准测试中,DeepSeek R1 仍略占优势。 在一系列基准测试中,Llama-3.1-Nemotron-Ultra-253B-v1 优于 Meta 最新发布的 Llama 4 Behemoth 和 Llama 4 Maverick。

优秀的个人博客,低调大师

效果预览!

solon-ai-mcp 是 solon-ai 的扩展特性。提供 mcp 协议的支持。通过它,可以方便的发布 Tool Service,方便的使用 Tool Service。 引入依赖包 <dependency> <groupId>org.noear</groupId> <artifactId>solon-ai-mcp</artifactId> <version>3.1.3-SNAPSHOT</version> </dependency> 服务端演示(发布工具服务) 引入依赖包后,服务端默认不会启用,需要通过配置启用。 solon.ai.mcp.server: enabled: true sseEndpoint: "/mcp/sse" 启用 mcp server 后,所有组件的@FunctionMapping方法,会自动成为 mcp server 的 tool 服务。 @Component public class McpServerTool { @FunctionMapping(description = "查询天气预报") public String getWeather(@FunctionParam(description = "城市位置") String location) { return "晴,14度"; } } public class McpServerApp { public static void main(String[] args) { Solon.start(McpServerApp.class, args); } } 客户端演示(使用工具服务) 客户端可以使用原生的 modelcontextprotocol 接口,也可以使用 McpClientWrapper (包装简化过) 直接调用 public void case1(){ McpClientWrapper mcpClient = new McpClientWrapper("http://localhost:8080", "/mcp/sse"); String rst = mcpClient.callToolAsText("getWeather", Map.of("location", "杭州")); } 绑定给模型使用 public void case2(){ ChatModel chatModel = null; McpClientWrapper mcpClient = null; chatModel.prompt("杭州今天的天气怎么样?") .options(options -> { //转为函数集合用于绑定 options.functionAdd(mcpClient.toFunctions()); }) .call(); } 项目仓库地址 gitee:https://gitee.com/opensolon/solon-ai gitcode:https://gitcode.com/opensolon/solon-ai github:https://github.com/opensolon/solon-ai 官网 https://solon.noear.org/article/learn-solon-ai

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册