Controlling each finger

Post Reply
User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Controlling each finger

Post by Mr. Kibernetik »

This is an example of controlling each finger during multitouch interaction.
This program allows to draw with several fingers simultaneously. Each finger gets its own drawing color.

Code: Select all

#.drawsize(20)
>
  > i, 1..#.tap()
    x,y = #.tap(i,2)
    ? #.tap(i)
      ox = old(oldx,i,x)
      oy = old(oldy,i,y)
      #.drawcolor(#.hsv2rgb(i*60,1,1):3)
      #.drawline(ox,oy,x,y)
    .
    oldx[i] = x; oldy[i] = y
  <
  > j, i..10
    oldx[j],oldy[j] = -1
  <
<
old(array,i,v)=
  x = array[i]
  ? x<0
    <= v
  .
  <= x
.
wp_ss_20170622_0002.png
wp_ss_20170622_0002.png (85.74 KiB) Viewed 2560 times

Post Reply