【李峋的爱心代码3】

部署运行你感兴趣的模型镜像

一、部分代码展示 

由于源码太多了,只展示部分代码,需要源码可私信我

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Beating heart ❤</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <script src='js/three.min.js'></script>
    <script src='js/MeshSurfaceSampler.js'></script>
    <script src='js/TrackballControls.js'></script>
    <script src='js/simplex-noise.js'></script>
    <script src='js/OBJLoader.js'></script>
    <script src='js/gsap.min.js'></script>
    <script src="js/script.js"></script>
</body>
</html>

二、效果图展示 

 

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

以下是一个 Java 实现的类似李峋跳动爱心代码: ```java import javax.swing.*; import java.awt.*; import java.util.ArrayList; import java.util.List; import java.util.Random; class Heart { int x, y; double scale; double scaleDelta; public Heart(int x, int y) { this.x = x; this.y = y; this.scale = 1; Random random = new Random(); this.scaleDelta = (random.nextDouble() * 0.1) + 0.05; } public void update() { scale += scaleDelta; if (scale > 1.5 || scale < 0.5) { scaleDelta = -scaleDelta; } } } public class BeatingHearts extends JPanel { private static final int WIDTH = 800; private static final int HEIGHT = 600; private static final int DELAY = 30; private List<Heart> hearts; public BeatingHearts() { hearts = new ArrayList<>(); Random random = new Random(); for (int i = 0; i < 50; i++) { int x = random.nextInt(WIDTH); int y = random.nextInt(HEIGHT); hearts.add(new Heart(x, y)); } Timer timer = new Timer(DELAY, e -> { for (Heart heart : hearts) { heart.update(); } repaint(); }); timer.start(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.RED); for (Heart heart : hearts) { for (double t = 0; t <= 2 * Math.PI; t += 0.01) { double x = 16 * Math.pow(Math.sin(t), 3) * heart.scale; double y = -(13 * Math.cos(t) - 5 * Math.cos(2 * t) - 2 * Math.cos(3 * t) - Math.cos(4 * t)) * heart.scale; int screenX = (int) (x + heart.x); int screenY = (int) (y + heart.y); g2d.fillRect(screenX, screenY, 2, 2); } } } public static void main(String[] args) { JFrame frame = new JFrame("Beating Hearts"); BeatingHearts heartPanel = new BeatingHearts(); frame.add(heartPanel); frame.setSize(WIDTH, HEIGHT); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } } ``` 这段代码实现了一个基于心形图案的动态生成动画,涉及到数学公式、图形绘制、随机数生成等多个方面的知识。它通过逐帧绘制来创建动画效果,并通过修改颜色、位置、大小等参数来实现动态展示[^1]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值