Setting the angle of a fillGradient?

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hwbehrens
Posts: 19
Joined: Fri Mar 19, 2010 9:10 pm

Setting the angle of a fillGradient?

Post by hwbehrens » Fri Mar 19, 2010 9:18 pm

I'm currently trying to apply a fillGradient to a graphic, and then modify the graphic's gradient later using a variety of sliders. So far I've used the fillGradient["repeat"] and fillGradient["ramp"] properties successfully, but now I'd like to be able to change the angle of the gradient.

I assume that I would be able to do some math using the "from" and "to" properties, the loc of the graphic, and the radius (it's a circle) to effect a new gradient orientation, but I'm wondering if there is an easier way. I've tried setting the angle of the graphic, which didn't work, and I've looked all through the fillGradient documentation without seeing any applicable properties.

Any suggestions would be most helpful.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Setting the angle of a fillGradient?

Post by bn » Fri Mar 19, 2010 9:51 pm

Hi hwbehrens,

welcome to the forum.
hwbehrens wrote:I assume that I would be able to do some math using the "from" and "to" properties, the loc of the graphic, and the radius (it's a circle) to effect a new gradient orientation
look at from, to, via properties to change the angle. You do have to do the math yourself.

I wish there were an angle property for the gradients, it would make for smother animations. As it is if you use the from/to/via you are bound to x,y coordinates which dont always make a smooth animation.

Maybe you find this helpful. In examining the fillgradient, which is an array, I use something like this:

Code: Select all

on mouseUp
   put the fillGradient of grc 1 into tFillArray
   combine tFillArray by return and tab
   put tFillArray
end mouseUp
It takes the array and converts it to a return tab format suitable for displaying in a field of in this case in the message box.
I use this to manually change aspects of the fillgradient and use this later for the scripted change of the gradients.

If you like gradients (I do) look at RevOnline and search either for bernd or gradients and have a look at some of the stuff I did with gradients.

regards
Bernd

hwbehrens
Posts: 19
Joined: Fri Mar 19, 2010 9:10 pm

Re: Setting the angle of a fillGradient?

Post by hwbehrens » Fri Mar 19, 2010 10:04 pm

Bernd,

Thanks for the suggestions. I took a look at your examples, and your beachball example was pretty much exactly what I am trying to do, specifically the gradients that orient to follow the mouse on drag. I had been using 'on mouseStillDown', but I think your variable flag method will provide much smoother animations.

Thanks again for the help!

- Hans

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Setting the angle of a fillGradient?

Post by bn » Fri Mar 19, 2010 10:17 pm

Hans,
I forgot to mention the gradient_explorer done by Scott Rossi of tactile media
http://www.tactilemedia.com/site_files/ ... er.rev.zip

Scott does amazing visual effects with Rev
http://www.tactilemedia.com/
at the top left go to software and then go for see all tutorials.
regards
Bernd

Post Reply

Return to “Multimedia”