当前位置:网站首页>Draw Bezier curve through screen interaction
Draw Bezier curve through screen interaction
2022-07-25 05:56:00 【Ma Nong on the island】
Preface
In the previous articles, we introduced the principle of Bessel curve 、 Draw curves and achieve dynamic effects , These are preset by the code , If we want to draw the curve by ourselves according to our needs , You need to use interaction to realize . In this article, we will first introduce the simple interactive drawing , Set the control point of Bezier curve by obtaining the touch position , So as to achieve interactive curve drawing .
Get touch location
The first problem to be solved is how to get the touch position of the finger on the screen . stay Flutter in , Provides a Listener Components , It can monitor all kinds of touch events .Listener The component construction method of is defined as follows :
const Listener({
Key? key,
this.onPointerDown,
this.onPointerMove,
this.onPointerUp,
this.onPointerHover,
this.onPointerCancel,
this.onPointerSignal,
this.behavior = HitTestBehavior.deferToChild,
Widget? child,
})
among onPointerXX Are callback methods for touch events , The touch location information will be carried in the callback , The specific parameters are as follows :
onPointerDown: Touch point press down ( Similar to the mouse pressed but not released ) The callback method for the , With onePointerDownEventParameters , This parameter will contain the click information , One of themlocalPositionParameters , That is, the position on time .onPointerUp: Touch and click Release
边栏推荐
- Programming hodgepodge (I)
- (2022牛客多校二)L-Link with Level Editor I(动态规划)
- ABC 261.D - Flipping and Bonus ( DP )
- Run length test of R language: use the runs.test function to perform run length test on binary sequence data (check whether the sequence is random)
- ABC 261.D - Flipping and Bonus ( DP )
- idea常用10个快捷键
- Qunhui NPV Suite (NPV server) Download
- HTB-Arctic
- Differences and application directions of GPS, base station and IP positioning
- What are the ways to realize web digital visualization?
猜你喜欢
随机推荐
PHP warehouse inventory management system source code WMS source code
Calculate BDP value and wnd value
Differences and application directions of GPS, base station and IP positioning
VIM configuring golang development environment
HTB-Arctic
G1 garbage collector
Concepts of phase velocity and phase in transmission line theory
Msys2 common configuration
Adaptation dynamics | in June, sequoiadb completed mutual certification with five products
50: Chapter 5: develop admin management service: 3: develop [query whether the admin user name already exists, interface]; (this interface can only be called when logging in; so we have written an int
New discovery of ROS callback function
基于ISO13209(OTX)实现EOL下线序列
Idea commonly used 10 shortcut keys
Programming hodgepodge (II)
CCID released the "Lake warehouse integrated technology research report", and Jushan database was selected as a typical representative of domestic enterprises
10、渲染基础
剑指 Offer 54. 二叉搜索树的第k大节点
Siggraph 2022 -- rendering iridescent rock dove neck feathers
Run length test of R language: use the runs.test function to perform run length test on binary sequence data (check whether the sequence is random)
HTB-Beep









