找回密码
 注册
搜索
查看: 24955|回复: 7

[工作记录] processing assignment--sin() function apply

[复制链接]
发表于 2010-10-8 00:38:04 | 显示全部楼层 |阅读模式
利用getting start with processing 練面的教材,加以改進 與大家分享。 概念: (1)使用sin ()function 產生y1.y2.y3 三個圓,並有相同的直徑。 (2)再加上不同的振幅 針對每個圓 加以*scalar (3)把這些關係在套用到fill() function 上面 產生random(R,G,B) a.JPG b.JPG c.JPG processing file - adjust original file by wei p102_1.pde (674 Bytes, 下载次数: 6, 售价: 1 lux照度) //////////////////////////////////////////////////// float angle = 0.0; float scalar = 100; float speed = 0.05; void setup(){ size(400,400); smooth(); background(255); } void draw(){ float y1 = sin(angle) * scalar; float y2 = sin(angle + 0.4) * scalar; float y3 = sin(angle + 0.8)* scalar; ellipse(random (height/2+ y1) ,random (width/2+ y1),40,40); ellipse(random (height/2+ y2) ,random (width/2+ y2),40,40); ellipse(random (height/2+ y3) ,random(width/2+ y3),40,40); float R = map(y1,-1 *scalar,1 *scalar,0,255); float G = map(y2,-1 *scalar,1 *scalar,0,255); float B = map(y3,-1 *scalar,1 *scalar,0,255); fill(R,G,B); angle += speed; println("y1 value = " + y1 ); } //////////////////////////////////////////////////// 目前所有的圓都集中在左上,使否有辦法把整個圓分布在所有視窗上,如果有人解決這問題可以,回覆我一下 謝謝。

评分

参与人数 1强度 +3 照度 +50 收起 理由
skywoolf + 3 + 50 原创内容

查看全部评分

发表于 2010-10-8 15:51:24 | 显示全部楼层
改下ellipse的坐标就好了 ellipse(random (height/2+ 2*y1) ,random (width/2+ 2*y1),40,40); ellipse(random (height/2+ 2*y2) ,random (width/2+ 2*y2),40,40); ellipse(random (height/2+ 2*y3) ,random(width/2+ 2*y3),40,40); QQ截图未命名.png (118.75 KB, 下载次数: 0)
回复

使用道具 举报

发表于 2010-10-8 16:58:51 | 显示全部楼层
果然适合画抽象图 哈哈~
回复

使用道具 举报

 楼主| 发表于 2010-10-8 18:20:48 | 显示全部楼层
感謝感謝,這樣看比較 漂亮 哈哈 。
回复

使用道具 举报

发表于 2010-12-24 15:42:51 | 显示全部楼层
good stuff
回复

使用道具 举报

发表于 2011-11-29 03:56:09 | 显示全部楼层
感谢楼主~~~~
回复

使用道具 举报

发表于 2011-12-3 19:01:38 | 显示全部楼层
processing自带的example里面有个类似的~~可以对比参考下
回复

使用道具 举报

发表于 2012-4-3 05:48:03 | 显示全部楼层
大哥下次注明密级恐惧症渗入啊
回复

使用道具 举报

NCFZ微信公众号

手机版|小黑屋|NCF参数化建筑论坛 ( 浙ICP备2020044100号-2 ) 辽公网安备21021102000973号

GMT+8, 2026-11-23 19:52 , Processed in 0.050840 second(s), 30 queries , Gzip On.

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表