当前位置:网站首页>pixi. JS drag function
pixi. JS drag function
2022-06-10 02:12:00 【weixin_ forty-four million three hundred and eighty-seven thous】
// Load fox
let fox = pixiTexture.from('https://img.alicdn.com/imgextra/i1/39767794/O1CN01t13qMt27RhbmdFfsh_!!39767794.png')
let firfox = new pixiSprite(fox)
application.stage.addChild(firfox)
// Mobile Fox
let flag = false
firfox.interactive = true
firfox.buttonMode = true
firfox.anchor.set(0.5) // Set the center point
firfox.x = application.screen.width / 2 // Fox initial position
firfox.y = application.screen.height - 300
// Sliding fox
firfox.on('touchstart', () => {
flag = true
})
.on('touchmove', (e) => {
if (flag) {
if (e.data.global.x > 115 / 2 && e.data.global.x < application.screen.width - 115 / 2 && e.data.global.y > 111 / 2 && e.data.global.y < application.screen.height - 111 / 2) {
firfox.x = e.data.global.x
firfox.y = e.data.global.y
} else {
}
}
})
.on('touchend', () => {
flag = false
})
.on('touchendoutside', () => {
flag = false
})
边栏推荐
- 2022年上海市安全员C证考试模拟100题及模拟考试
- PAT (Advanced Level) Practice 1156 Sexy Primes (试除法)
- Metauniverse can open a new thinking window for the Internet which is falling into a bottleneck period
- Alibaba cloud 618 award winning experience: build an OSS based image sharing website
- Detailed billing information tables of cptevents and drgcodes (XIII)
- Web server-side technical test question bank
- SSM框架整合-搭建简单账号登录系统
- 【LeetCode】105. Constructing binary trees from preorder and inorder traversal sequences
- kubelet启动一个Pod CRI、CNI、CSI 起作用的顺序
- MySQL表管理(文件)
猜你喜欢

Web server-side technical test question bank

2022年制冷与空调设备运行操作复训题库模拟考试平台操作
![[leetcode] connected to rainwater](/img/93/8caf413768eaa9765d3fb13d7dbf37.png)
[leetcode] connected to rainwater

Add MySQL path to system environment variable (win10)

服务器停止响应是什么意思,该如何排查?

2022 Shanghai safety officer C certificate examination simulation 100 questions and simulation examination

Hoo Hufu Research Institute | houlang in the coin circle - gamefi like baokemeng: evoverses

Data product learning - real time computing platform

From 0 to 1, explore the MVVM framework design under 10 billion traffic verification

Smart Cloud Light Gateway Service pour améliorer l'efficacité de la gestion de la production
随机推荐
Full score after 5 years of "research" and 3 years of "actual combat"
Electron桌面端开发(能力、如何打包、优势)
Introduction à la définition et au calcul de la variance Allan
3、NLP模型
2、自然语言处理入门
Unity netcode for GameObject 1.0.0 learning notes (I) - Hello World demo
Operation of simulated examination platform of recurrent training question bank for operation of refrigeration and air conditioning equipment in 2022
wps 调整文字间距
Is Haitong Securities safe
Innftnews | l'avenir de NFT dans l'économie web3
Apache POI learning notes - Excel
Kubelet starts a sequence in which pod CRI, CNI and CSI work
Word 教程,如何在 Word 中应用样式、主题?
MDK 5.37 error: unknown register name 'control' and error: c9932e: cannot obtain license for compiler
機智雲輕網關服務,提昇生產管理效率
What does the server stop responding mean and how to troubleshoot it?
[email protected] Project training
证明婚内出轨的几种证据
Phantom engine plug-in - Maya LIVELINK - install and use
【WIN】浏览器打不开网页出现DNS_PROBE_FINISHED_NO_INTERNET