当前位置:网站首页>Processsing 鼠标交互 学习
Processsing 鼠标交互 学习
2022-06-26 12:37:00 【天人合一peng】
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 3-2: mouseX and mouseY
boolean mousePress = false;
void setup() {
size(640,360);
}
void draw() {
// Try moving background() to setup() and see the difference!
background(255);
// Body
stroke(0);
fill(175);
rectMode(CENTER);
// mouseX is a keyword that the sketch replaces with the horizontal position of the mouse.
// mouseY is a keyword that the sketch replaces with the vertical position of the mouse.
rect(mouseX,mouseY,50,50);
}
void mousePressed(){
stroke(255, 0, 0);
line(mouseX-10,mouseY, mouseX+10,mouseY);
line(mouseX,mouseY-10, mouseX,mouseY+10);
mousePress = true;
}
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 3-5: mousePressed and keyPressed
void setup() {
size(640, 360);
background(255);
}
void draw() {
// Nothing happens in draw() in this example!
}
// Whenever a user clicks the mouse the code written inside mousePressed() is executed.
void mousePressed() {
stroke(0);
fill(175);
rectMode(CENTER);
rect(mouseX,mouseY,16,16);
}
// Whenever a user presses a key the code written inside keyPressed() is executed.
void keyPressed() {
background(255);
}
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 3-5: mousePressed and keyPressed
void setup() {
size(640, 360);
background(255);
}
void draw() {
// Nothing happens in draw() in this example!
}
// Whenever a user clicks the mouse the code written inside mousePressed() is executed.
void mousePressed() {
stroke(255, 0, 0);
strokeWeight(2);
fill(175);
rectMode(CENTER);
//rect(mouseX,mouseY,16,16);
circle(int(mouseX),int(mouseY),16);
}
// Whenever a user presses a key the code written inside keyPressed() is executed.
void keyPressed() {
background(255);
}
边栏推荐
- 无人机遥感在森林监测的部分应用研究案例总结
- Wechat applet wx Request request encapsulation
- 小程序中控件里面的内容较多,让其支持滚动的良好方案
- 国标GB28181协议EasyGBS级联宇视平台,保活消息出现403该如何处理?
- TP5 thinkphp5 report serialization of'closure'is not allowed
- 详细实操分享,下班刷了两小时的搞笑视频,一个月收益7000多
- Redis learning - 02 common data types, operation commands and expiration time
- Redis learning - 01 introduction, installation and configuration
- Laravel+gatewayworker completes the im instant messaging and file transfer functions (Chapter 4: server debugging errors)
- 7-3 最低通行费
猜你喜欢

Several rare but useful JS techniques

The laravel dingo API returns a custom error message

Stream流学习记录

A must for programmers, an artifact utools that can improve your work efficiency n times

Examples of how laravel uses with preload (eager to load) and nested query

深入解析 MySQL binlog

ES6:Map

不到40行代码手撸一个BlocProvider

File remote synchronization and backup artifact Rsync

Php+laravel5.7 use Alibaba oss+ Alibaba media to process and upload image / video files
随机推荐
[solved] laravel completes the scheduled job task (delayed distribution task) [execute a user-defined task at a specified time]
Sharing ideas for a quick switch to an underlying implementation
power designer - 自定义注释按钮
Thinkphp5 query report: sqlstate[hy093]: invalid parameter number
Research and development practice of Kwai real-time data warehouse support system
班主任让开股票账户,在挖财理财开户安全吗?
Adobe Acrobat阻止30款安全软件查看PDF文件 或存在安全风险
2022 edition of Beijing 5g industry investment planning and development prospect forecast analysis report
【网络是怎么连接的】第二章(中):一个网络包的发出
PHP laravel+gatewayworker completes im instant messaging and file transfer functions (Chapter 2: explanation of business logic)
7-2 数的三次方根
计组实践实验9——使用CMStudio设计基于分段模型机微程序指令(2)
NLP-D60-nlp比赛D29
详细实操分享,下班刷了两小时的搞笑视频,一个月收益7000多
PHP uses laravel pay component to quickly access wechat jsapi payment (wechat official account payment)
Analysis report on the "fourteenth five year plan" and investment prospect of China's pharmaceutical equipment industry 2022-2028
由错误<note: candidate expects 1 argument, 0 provided>引发的思考
How long ago did PHP get
国标GB28181协议EasyGBS视频平台TCP主动模式拉流异常情况修复
The laravel dingo API returns a custom error message