【Processing入门】第六七章:函数和数组
来源:互联网 发布:大连高新达内软件 编辑:程序博客网 时间:2024/05/22 01:59
1.函数和数组的使用案例
Eye[] hiEye = new Eye[100];void setup(){ size(300,300); smooth(); panda(100,100,2); panda(200,200,1.3); }void panda(int x,int y,float s){ pushMatrix(); translate(x,y); scale(s); //ears fill(0); strokeWeight(1); stroke(255); ellipse(-35,-25,35,35); ellipse(35,-25,35,35); //head fill(255); strokeWeight(1); stroke(0); ellipse(0,0,100,90); //eye fill(0); ellipse(-25,5,30,35); ellipse(25,5,30,35); fill(255); ellipse(-25,0,6,6); ellipse(25,0,6,6); fill(0); ellipse(0,25,7,5); noFill(); stroke(0); strokeWeight(1); bezier(-2.5,35,-2.5,37,2.5,37,2.5,35); popMatrix();}class Eye{ color c; float x; void display() { }}
2.图片的使用
tint()用于设置图片的色彩填充值
PImage photo;void setup(){ size(300,300); photo=loadImage("008.jpg"); tint(255,0,255,50);}void draw(){ background(0); //image(photo,0,0); //image(photo,0,0,150,150); image(photo,mouseX,mouseY,150,150); int h = int(random(photo.height)); int w = int(random(photo.width)); int all=w+h*photo.width; loadPixels(); float r = red(photo.pixels[all]); float g = green(photo.pixels[all]); float b = blue(photo.pixels[all]);}
3.文字
PFont f;PFont f_new;String message = "Processing is coming!";void setup(){ size(300,300); smooth(); f=loadFont("SegoeUI-Light-48.vlw"); f_new=createFont("Arial",36,true); textFont(f,48); textFont(f_new,48);}void draw(){ background(200); textSize(48); fill(0); text("I feel fine",10,100); textSize(36); text("I feel fine",10,150); textSize(24); text("I feel fine",10,190); fill(255,255,0); text(message,10,10,290,290);}
0 0
- 【Processing入门】第六七章:函数和数组
- processing的入门函数
- 《Red5 用户参考手册》之七:入门第六章 发布 Red5 和 入门第七章 Red5 的系统要求
- 《Red5 用户参考手册》之七:入门第六章 发布 Red5 和 入门第七章 Red5 的系统要求
- Java入门 第一季第六章 数组
- 第六章:数组和字符串
- 【Processing入门】第二章:使用Processing
- 【Processing入门】Processing第三章:绘图中
- 【Processing入门】Processing第三章:绘图下
- 【Processing入门】第五章:动画
- java从入门到精通第六章数组笔记
- Processing 入门
- C++快速入门 (七) 再谈指针和函数
- php入门(数组,函数,类和对象)
- 【C】【笔记】《C和指针》 第六章 指针 第七章 函数 第八章 数组 第九章 字符串、字符和字节
- 第六章 存储函数和过程
- 第六章:集合函数和分组
- F#入门-第二章 F#基础-第六节 匿名函数
- 左连接、右连接、交叉连接、全外连接
- jquery中的*(通用) 选择器实例
- 启用windows7家庭版的管理员帐号
- 在脚本里判断Gameobject是否被销毁
- ip安全策略的运用
- 【Processing入门】第六七章:函数和数组
- 网络管理员实用命令
- HDU 1025 Constructing Roads In JGShining's Kingdom
- 第9周项目一(do-while语句)
- final关键字之final方法
- PopUpRenderer弹出框
- vc++ mfc中拖动效果的实现
- merri的开发手册
- poj1163