旋转的月亮动画2-通过复制像素创建动画

月球动画创作
本文介绍了一种通过复制像素创建月球旋转动画的方法。利用一张包含两份月球表面图像的照片,通过水平滚动实现球体旋转的视觉效果。文章详细解释了如何使用ActionScript进行操作。
[color="#c0c0c0"]Creating animation by copying pixels[/color]
通过复制点创建动画
[color="#c0c0c0"]A basic definition of animation is the illusion of motion, or change, created by changing an image over time.
[/color]
动画的一个基本定义是通过在一定时间内改变或移动图像而产生的幻觉。
[color="#c0c0c0"]In this sample, the goal is to create the illusion of a spherical moon rotating around its vertical axis.
[/color]
在本例中,目标是创建球状的月亮在它竖直轴附近转动的幻觉影像。
[color="#c0c0c0"]However, for the purposes of the animation, you can ignore the spherical distortion aspect of the sample.
[/color]
但是,为了动画的目的,你可以忽略例子的球状变形的问题
[color="#c0c0c0"]Consider the actual image that’s loaded and used as the source of the moon image data:
[/color]
考虑到实际加载并使用的图像是这样的月亮图像
[img]/uploads/allimg/080326/1821270.jpg[/img]
[color="#c0c0c0"]As you can see, the image is not one or several spheres; it’s a rectangular photograph of the surface of the moon.
[/color]
就像你看到的,图像不是一个或几个面,它是一个长方形的月亮表面的图像
[color="#c0c0c0"]Because the photo was taken exactly at the moon’s equator,
[/color]
因为,图像是从月亮的赤道上方拍摄来的
[color="#c0c0c0"]the parts of the image that are closer to the top and bottom of the image are stretched and distorted.
[/color]
部分靠近顶端和底端图像是变形了的图像
[color="#c0c0c0"]To remove the distortion from the image and make it appear spherical, we will use a displacementmap filter, as described later.
[/color]
为了消除变形,使其看上去像个球,我们将用到一个像后面描述的displacementmap过滤器,
[color="#c0c0c0"]However, because this source image is a rectangle, to create the illusion that the sphere is rotating, the code simply needs to slide the moon surface photo horizontally, as described in the following paragraphs.
[/color]
尽管如此,因为源图像是个长方形,为了创建创建球型转动的幻觉,代码需要将月球表面照片转换成地平面。下文详谈。
[color="#c0c0c0"]Notice that the image actually contains two copies of the moon surface photograph next to each other.
[/color]
注意 图像实际上包含月亮表面图像的两个copy
[color="#c0c0c0"]This image is the source image from which image data is copied repeatedly to
create the appearance of motion.
[/color]
这个图像是用来创建月亮外貌的源数据
[color="#c0c0c0"]By having two copies of the image next to each other, a continuous, uninterrupted scrolling effect can more easily be created.
[/color]
把图像的复制一个在它的旁边,有利于创建旋转效果。
[color="#c0c0c0"]Let’s walk through the process of the animation step-by-step to see how this works.
[/color]
让我们通过看动画制作的一个个步骤来理解其原理
[color="#c0c0c0"]The process actually involves two separate ActionScript objects.
[/color]
整个步骤实际上包含了两个相对独立的ActionScript对象(模块)
[color="#c0c0c0"]First, there is the loaded source image, which in the code is represented by the BitmapData instance named textureMap.
[/color]
首先,有个被加载的源图像,在代码中它被存储在BitmapData类型变量textureMap中
[color="#c0c0c0"]As described previously, textureMap is populated with image data as soon as the
external image loads, using this code:
[/color]
就像前面讨论的,textureMap是在图像加载完毕的时候被赋值的,下面是代码:
[color="#c0c0c0"]textureMap = event.target.content.bitmapData;The content of textureMap is the image shown previously.
[/color]
textureMap的内容就是前面展示过的那图像
[color="#c0c0c0"]In addition, to create the animated rotation,
[/color]
另外为了创建真实的旋转效果
[color="#c0c0c0"]the sample uses a Bitmap instance named, which is the actual display object that shows the moon image onscreen.
[/color]
例中使用了一个叫sphere的Bitmap类型变量,它是真正把图像显示在屏幕上的量
[color="#c0c0c0"]Like textureMap, the sphere object is created and populated with its initial image data in the imageLoadComplete() method, using the following code:
[/color]
就像textureMap类似,sphere对象在imageLoadComplete()函数中初始化图像数据,下面是代码
[color="#ff6600"]sphere = new Bitmap();
sphere.bitmapData = new BitmapData(textureMap.width / 2,textureMap.height);
sphere.bitmapData.copyPixels(textureMap,new Rectangle(0, 0, sphere.width, phere.height),new Point(0, 0));
[/color]
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/515.html
基于遗传算法的新的异构分布式系统任务调度算法研究(Matlab代码实现)内容概要:本文档围绕基于遗传算法的异构分布式系统任务调度算法展开研究,重点介绍了一种结合遗传算法的新颖优化方法,并通过Matlab代码实现验证其在复杂调度问题中的有效性。文中还涵盖了多种智能优化算法在生产调度、经济调度、车间调度、无人机路径规划、微电网优化等领域的应用案例,展示了从理论建模到仿真实现的完整流程。此外,文档系统梳理了智能优化、机器学习、路径规划、电力系统管理等多个科研方向的技术体系与实际应用场景,强调“借力”工具与创新思维在科研中的重要性。; 适合人群:具备一定Matlab编程基础,从事智能优化、自动化、电力系统、控制工程等相关领域研究的研究生及科研人员,尤其适合正在开展调度优化、路径规划或算法改进类课题的研究者; 使用场景及目标:①学习遗传算法及其他智能优化算法(如粒子群、蜣螂优化、NSGA等)在任务调度中的设计与实现;②掌握Matlab/Simulink在科研仿真中的综合应用;③获取多领域(如微电网、无人机、车间调度)的算法复现与创新思路; 阅读建议:建议按目录顺序系统浏览,重点关注算法原理与代码实现的对应关系,结合提供的网盘资源下载完整代码进行调试与复现,同时注重从已有案例中提炼可迁移的科研方法与创新路径。
【微电网】【创新点】基于非支配排序的蜣螂优化算法NSDBO求解微电网多目标优化调度研究(Matlab代码实现)内容概要:本文提出了一种基于非支配排序的蜣螂优化算法(NSDBO),用于求解微电网多目标优化调度问题。该方法结合非支配排序机制,提升了传统蜣螂优化算法在处理多目标问题时的收敛性和分布性,有效解决了微电网调度中经济成本、碳排放、能源利用率等多个相互冲突目标的优化难题。研究构建了包含风、光、储能等多种分布式能源的微电网模型,并通过Matlab代码实现算法仿真,验证了NSDBO在寻找帕累托最优解集方面的优越性能,相较于其他多目标优化算法表现出更强的搜索能力和稳定性。; 适合人群:具备一定电力系统或优化算法基础,从事新能源、微电网、智能优化等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于微电网能量管理系统的多目标优化调度设计;②作为新型智能优化算法的研究与改进基础,用于解决复杂的多目标工程优化问题;③帮助理解非支配排序机制在进化算法中的集成方法及其在实际系统中的仿真实现。; 阅读建议:建议读者结合Matlab代码深入理解算法实现细节,重点关注非支配排序、拥挤度计算和蜣螂行为模拟的结合方式,并可通过替换目标函数或系统参数进行扩展实验,以掌握算法的适应性与调参技巧。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值