HTML5模仿逼真地球自转

查看效果:http://hovertree.com/texiao/html5/8.htm给我一个支点,我就可以撬动地球阿基米德下载http://hovertree.com/down/h/earthh

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

全栈程序员社区此处内容已经被作者隐藏,请输入验证码查看内容
验证码:
请关注本站微信公众号,回复“验证码”,获取验证码。在微信里搜索“全栈程序员社区”或者“www_javaforall_cn”或者微信扫描右侧二维码都可以关注本站微信公众号。

查看效果:http://hovertree.com/texiao/html5/8.htm

HTML5模仿逼真地球自转

给我一个支点,我就可以撬动地球 阿基米德

下载 http://hovertree.com/down/h/earthhovertree.htm

代码如下:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>html5 canvas让地球转动起来 - 何问起</title><base target="_blank" />
<script type="text/javascript" src="http://hovertree.com/texiao/html5/8/clay.min.js"></script>
<script type="text/javascript">
function Earth() {
var stage = new Clay.Stage(800, 600);
var world = stage.getWorld();
var camera = stage.getCamera();

camera.set(0,0,0);
camera.setResolution(800, 600);
camera.setTarget(new Clay.Vector(-100,0,100));

window.onresize = function() {
stage.resizeTo(
800,600
);
};

window.onresize();
Clay.Collada.load('http://hovertree.com/texiao/html5/8/earth.xml', function (scene) {
scene.init(stage);

var earth = new Clay.Texture('http://hovertree.com/texiao/html5/8/earthmap1k.jpg', stage);

var clouds = new Image();
clouds.src = 'http://hovertree.com/texiao/html5/8/earthclouds1k.png';

var dark = new Image();
dark.src = 'http://hovert'+'ree.com/texiao/html5/8/darkside.png';

var waiting = setInterval(function(){
if (earth.complete && clouds.complete && dark.complete){
clearInterval(waiting);
play();
}
}, 1000);

function play() {
var shape = world.getShapes()[0];
shape.setMaterial(earth);

var x, y, z, t = Math.PI/4, r = 0, tick = 0.01, radius = 200;
var ttx = earth.canvas.getContext('2d');
var base = earth.image;
var wind = 0;

stage.addEvent('enterframe', function(){

ttx.drawImage(base, 0,0);
var pos = (++wind)%1000;
ttx.drawImage(clouds, pos, 0);
ttx.drawImage(clouds, pos-1000, 0);
ttx.drawImage(dark, 0,0);

t += tick;
x = -100 + Math.sin(t) * radius;
z = 100 + Math.cos(t) * radius;
y = Math.cos(t/3) * 50
camera.set(x, y, z);
});

stage.run();
}
});
}
window.addEventListener('load', function(){
new Earth();
}, false); 
</script>
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
position: relative;
background: black;
}

.canvas3D {
background: black;
position: absolute;
left: 0;
top: 0;
}
.earthhovertree{z-index:4321;position:fixed;left:789px;color:white;height:1234px}a{color:white}
</style>
</head>
<body>
<div class="earthhovertree">
<h3>给我一个支点,我就可以撬动地球 阿基米德</h3>
<h3>给我一个HTML5浏览器,我就能转动地球 何问起</h3>
<a href="http://hovertree.com">首页</a>
<a href="http://hovertree.com/texiao/">特效</a>
<a href="http://hovertree.com/hvtart/bjae/dubjwt12.htm">原文</a>
<a href="http://hovertree.com/texiao/html5/7.htm">时钟</a>
<a href="http://hovertree.com/texiao/css/12.htm">登录</a>
<a href="http://hovertree.com/texiao/css/8.htm">打火机</a>
<a href="http://hovertree.com/texiao/html5/6.htm">玫瑰花</a>
<a href="http://hovertree.com/texiao/css/9.htm">3D文字</a>  <a href="http://hovertree.com/texiao/html5/9.htm">太阳系</a>
<br />Clay - A 3D engine on canvas
<br />
<img src="https://gitee.com/system_mush/my-jsp-tutorial/raw/jsp/my_tutorial/2021/12/29e1e15f-7ad2-4544-aa6e-d5b2fd0bb0c6-1639931084838.jpg" alt="阿基米德" />

</div>
<div>
<div id="canvas">
您的浏览器不支持canvas,请使用支持HTML5的浏览器查看本页。何问起 hovertree.com
</div>
</div>
</body>
</html>

更多: http://www.cnblogs.com/roucheng/p/texiao.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/120689.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Mysql 多表连接查询

    Mysql 多表连接查询本文部分内容转载至:Mysql多表查询详解,同时感谢原作者的整理与创作;

    2022年5月22日
    19
  • pandownload激活码_pandownload账号

    pandownload激活码_pandownload账号yunfile网盘是国内的一个免费网盘,很多网站博客都会使用yunfile网盘的外链。但是该网盘广告多,等待时间长,免费用户只能一次下载一个文件,而且不能用迅雷等下载软件来下载,只能用IE,Chrome,Firefox等浏览器下载,下载速度又极其缓慢。但是有时候我们又不得不在该网盘下载文件,这个时候有一个yunfile网盘会员账号就可以解决上面所说的问题了。有求yunfile会员账号的朋友…

    2025年9月25日
    8
  • java逻辑删除代码_MybatisPlus实现逻辑删除功能

    java逻辑删除代码_MybatisPlus实现逻辑删除功能逻辑删除你有没有见过某些网站进行一些删除操作之后,你看不到记录了但是管理员却能够查看到。这里就运用到了逻辑删除。什么是逻辑删除?逻辑删除的本质是修改操作,所谓的逻辑删除其实并不是真正的删除,而是在表中将对应的是否删除标识(deleted)或者说是状态字段(status)做修改操作。比如0是未删除,1是删除。在逻辑上数据是被删除的,但数据本身依然存在库中。对应的SQL语句:updateusers…

    2022年6月2日
    115
  • Pytest(13)命令行参数–tb的使用

    Pytest(13)命令行参数–tb的使用前言pytest使用命令行执行用例的时候,有些用例执行失败的时候,屏幕上会出现一大堆的报错内容,不方便快速查看是哪些用例失败。–tb=style参数可以设置报错的时候回溯打印内容,可以设置参

    2022年7月30日
    6
  • Android常用控件

    Android常用控件TextView显示文本<TextViewandroid:id="@+id/text_view"android:layout_width="match_pa

    2022年7月2日
    22
  • ideaspringboot启动_idea中java代码无法运行

    ideaspringboot启动_idea中java代码无法运行idea解决Command line is too long. Shorten command line for ServiceStarter or also for Application报错1.在IDEA里找到”.idea===>workspace.xml”2.找到,在里面添加即可

    2022年8月19日
    4

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号