processing制作动态山水背景
效果
代码
float theta, step;
int num=5, frames = 1200;
Layer[] layers = new Layer[num]; // void setup() {
size(600, 400);
step = (height-120)/num;
for (int i=0; i<num; i++) {
layers[i] = new Layer(-20+i*step, random(1000), i+1);
}
} void draw() {
background(#ffffff);
for (int i=0; i<layers.length; i++) {
color col = lerpColor(#4A14C1, #ffffff, 0.8-0.8/num*i);
fill(col);
layers[i].display();
}
theta += TWO_PI/frames; //if (frameCount%2==0 && frameCount<=frames) saveFrame("image-###.gif");
} class Layer { float start, noize, speed;
float yOff, yOff2; Layer(float _start, float _noize, float _speed) {
start = _start;
noize = _noize;
speed = _speed;
} void display() {
yOff = yOff2;
noStroke();
for (int x=0; x<width; x+=1) {
float y = start + noise(noize+sin(yOff)*3)*step*3.5;
rect(x, height, 1, -height+y);
yOff+=TWO_PI/(width);
}
yOff2=theta*speed;
}
}
参考链接:http://iprocessing.cn/2017/10/22/第八期%ef%bc%9aprocessing制作动态山水背景/
processing制作动态山水背景的更多相关文章
- 利用scale9sprite制作动态聊天背景
先上效果图 首先创建Scale9Sprite然后设置设置一个比较重要的属性 auto pScale9bg = ui::Scale9Sprite::create(); pScale9bg->set ...
- Xcode + Swift 制作动态原型
转载: Xcode + Swift 制作动态原型 为什么是 Xcode 和 Swift 我们尝试过的动态原型设计工具,Origami, Form, Hype, FramerJS,Pixate 等,但都 ...
- 如何使用Camtasia制作动态动画场景?
也许在学习编辑视频的你知道Camtasia 2019(win系统),知道Camtasia的视频编辑功能,录制屏幕功能,但你可能想不到,Camtasia还可以制作动态动画场景.跟我一起学习一下吧! 一. ...
- Xcode 6制作动态及静态Framework
技术交流新QQ群:414971585 有没有写SDK或者要将一些常用的工具类做成Framework的经历? 你或许自己写脚本完成了这项工作,相信也有很多的人使用 iOS-Universal-Frame ...
- Xcode 6制作动态及静态Framework和各种坑
Xcode 6制作动态及静态Framework http://www.cocoachina.com/ios/20141126/10322.html 有没有写SDK或者要将一些常用的工具类做成Frame ...
- 5.11-5.15javascript制作动态表格
制作动态表格的主要是运用js中表格类的insertRow.insertCell简易添加行和列的代码,不过要注意每行添加的表格是有位置行编号的,每行的编号为rows.length-1,增加的表格内的标签 ...
- 【转】Xcode 6制作动态及静态Framework
http://years.im/Home/Article/detail/id/52.html 创建iOS动态库 新建工程并选择默认Target为Cocoa Touch Framework, 如图: 做 ...
- 一款非常炫酷的jQuery动态随机背景滚动特效
一款非常炫酷的jQuery动态随机背景滚动特效 图片背景会不停息的滚动,带有那种漂浮的视觉效果,小圈圈飘动. 更好的是还兼容IE6浏览器,大伙可以好好研究研究. 适用浏览器:IE6.IE7.IE8.3 ...
- xCode6制作动态及静态Framework(转)
原文:http://years.im/Home/Article/detail/id/52.html 相关推荐:http://www.cocoachina.com/ios/20150127/11022. ...
随机推荐
- linux jar 后台运行
在linux系统中可以利用nohup来执行任何命令,并把命令自动调到linux后台运行,不锁定当前ssh窗口,也不会被ctrl + c,alt + F4之类打断程序的动行.如: nohup java ...
- [翻译]Nativescript 中 Web 视图与 Android/IOS 的双向通信
English document From http://shripalsoni.com/blog/nativescript-webview-native-bi-directional-communi ...
- LabVIEW - 破解加密vi
步骤 使用二进制阅读软件打开加密vi 查找字段"00 00 00 30",其后的16位即可能是密码(可能查找到多个位置带有该字段,只有其中之一为密码位置) 将查找到的密码复制到MD ...
- 19个很有用的 JavaScript库推荐
流行的 JavaScript 库有jQuery,MooTools,Prototype,Dojo和YUI等,这些 JavaScript 库功能丰富,加上它们众多的插件,几乎能实现任何你需要的功能 然而需 ...
- 【Java】NIO中Channel的注册源码分析
Channel的注册是在SelectableChannel中定义的: public abstract SelectionKey register(Selector sel, int ops, Obje ...
- ZOJ3469 Food Delivery
Food Delivery ZOJ - 3469 题意:外卖送饭给N个顾客,要求他们不满度和最小,没人不满度=等待时间*耐心值 #include<cstring> #include< ...
- Luogu P1155 双栈排序 图论?模拟吧。。
今天想做做图论,于是点开了这道题....(是二分图染色然而我没看出来) 四种操作及条件: 1. s1.push() 需满足 待push的元素小于栈顶 && { 若在原序列中,待push ...
- CodeForces - 1003-B-Binary String Constructing (规律+模拟)
You are given three integers aa, bb and xx. Your task is to construct a binary string ssof length n= ...
- 用 scp 命令通过 SSH 互传文件
上传单个文件到远程服务器 命令格式 scp [/path/local_dir/filename] [username@servername:/path/remote_dir] 上传本地的 vimrc ...
- Netty(2)Echo
上节介绍的是discard协议,即不给客户端返回消息.本节主要说下,echo协议,即服务端收到消息后原样返回给客户端. 为了实现此需求,只需要在DiscardServerHandler中重写chann ...