源码
@SneakyThrows
public static void main(String[] args) {
int count = 0;
for (float y = 2.5f; y > -2.0f; y -= 0.12f) {
for (float x = -2.3f; x < 2.3f; x += 0.041f) {
float tempValue = (x * x) + (y * y) - 4f;
if (((tempValue * tempValue * tempValue) - (x * x * y * y * y)) < -0.0f) {
String tempStr = "I LOVE YOU ";
int tempNum = count % tempStr.length();
System.err.print("\033[31m" + tempStr.charAt(tempNum));
count++;
} else {
System.err.print(" ");
}
}
System.out.println();
Thread.sleep(100);
}
String tempContent = "祝你顺风顺水顺财神,朝朝暮暮有人疼~";
char[] charArray = tempContent.toCharArray();
for (char item : charArray) {
Thread.sleep(300);
System.err.print("\033[32m" + item);
}
Thread.sleep(600);
System.err.print(" ლ(´ڡ`ლ)");
}
效果图
![爱心代码效果图](https://i-blog.csdnimg.cn/blog_migrate/172dde3a49a9b1e6a207fe088d960d23.png)