a customized drag command

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: a customized drag command

Post by richmond62 » Fri Apr 08, 2022 9:14 am

Indeed: it is important to have evenly spaced 'jumps' in your multi-point line.

That is why in both my linear and my circular example I have taken pains to ensure the jumps
are even:

Calculate the total distance and divide it by however many 'jumps' you want . . .

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: a customized drag command

Post by Samuele » Wed Apr 27, 2022 2:50 pm

richmond62 wrote:
Fri Apr 08, 2022 9:14 am
That is why in both my linear and my circular example I have taken pains to ensure the jumps
are even:
how did you ensure that all the points are at the same distance from one another?
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: a customized drag command

Post by richmond62 » Wed Apr 27, 2022 7:31 pm

how did you ensure that all the points are at the same distance from one another?
Nothing more than a bit of very simple Mathematics: dig around in my stack: I have a feeling that there is
a hidden button with a script to generate a cirle somewhere . . .

. . . if you have no luck send me a message and I'll see if I can find that stack amongst my piles and piles
of stuff. 8)

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: a customized drag command

Post by Samuele » Thu Apr 28, 2022 10:49 am

yes it's this:

Code: Select all

on mouseUp
   put empty into fld "PPP"
   wait 10 ticks
   put 0.1 into SEED
   repeat until SEED > 7
      put ((300 * (cos(SEED))) + 350) into COSSEED
      put ((300 * (sin(SEED))) + 350) into SINSEED
      put (SEED * 10) into TSEED
      put COSSEED & "," & SINSEED into line TSEED of fld "PPP"
      add 0.1 to SEED
   end repeat
   set the points of grc "CC" to fld "PPP"
end mouseUp
but I don't quite understand it, which formulas you use? Is it like this because it's a circle? and if I want to do it with a line it would be simpler?
sorry for my ignorance
Thanks!
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: a customized drag command

Post by richmond62 » Thu Apr 28, 2022 11:21 am

which formulas you use? Is it like this because it's a circle?
I use one formula which 'Bonehead' Barker, my fantastic Maths teacher taught my class
when I was 13 so we could plot a circle, by hand,on a piece of graph paper with a pencil.

I am extremely grateful for the fact that when I was 13 all we had were slide-rules, logarithmic tables,
pencils, paper and our brains, so we understood the underpinnings of stuff like plotting a curve which
is hidden away by calculators and computers,

Obviously if you want a different type of line you will need a different formula.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”