当前位置:网站首页>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);
}
边栏推荐
- Summary of some application research cases of UAV Remote Sensing in forest monitoring
- 程序员必备,一款让你提高工作效率N倍的神器uTools
- 几行代码就能实现复杂的 Excel 导入导出,这个工具类真心强大!
- 班主任让开股票账户,在挖财理财开户安全吗?
- KITTI Detection dataset whose format is letf_top_right_bottom to JDE normalied xc_yc_w_h
- 环形队列php
- Tiger DAO VC产品正式上线,Seektiger生态的有力补充
- sqlalchemy event listen Automatic generate CRUD excel
- 【shell】生成指定日期之间的字符串
- How long ago did PHP get
猜你喜欢

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

Xiaolong 888 was released, Xiaomi 11 was launched, and 14 manufacturers carried it in the first batch!

关于NaN的一些总结

MySQL 自定义函数时:This function has none of DETERMINISTIC, NO SQL 解决方案

Research and development practice of Kwai real-time data warehouse support system

深度解析当贝盒子B3、腾讯极光5S、小米盒子4S之间的区别

Tiger DAO VC产品正式上线,Seektiger生态的有力补充

Realize microservice load balancing (ribbon)

环形队列php
![[BSidesCF 2019]Kookie 1](/img/22/585d081668e67b8389a1b90aaebe9d.png)
[BSidesCF 2019]Kookie 1
随机推荐
【网络是怎么连接的】第二章(下):一个网络包的接收
[solved] data duplication or data loss after laravel paginate() paging
2022 edition of China's energy and chemical industry market in-depth investigation and investment feasibility analysis report
不到40行代码手撸一个BlocProvider
EasyGBS如何解决对讲功能使用异常?
PHP get directory size
Stream流学习记录
find及du -sh显示权限不够的解决方法
sqlalchemy event listen Automatic generate CRUD excel
一个初级多线程服务器模型
国标GB28181协议EasyGBS视频平台TCP主动模式拉流异常情况修复
7-1 n皇后问题
Mongodb of NoSQL - 03 mongodb CRUD
班主任让开股票账户,在挖财理财开户安全吗?
2022 edition of Beijing 5g industry investment planning and development prospect forecast analysis report
710. 黑名单中的随机数
New routing file in laravel framework
Typescript learning (I) type
PHP laravel+gatewayworker completes im instant messaging and file transfer (Chapter 1: basic configuration)
ES6:Map