Page 1 of 1

Adjusting image opacity using slider

Posted: Tue Nov 05, 2013 2:44 pm
by calmrr3
Hi,

I am trying to adjust the blendLevel of an image using a scrollbar.

on mouseUp
  if the thumbpos of me = 5 then
set the blendLevel of img "strip1" to 0
else set the blendLevel of img "strip1" to 100
end mouseUp

Above: this is the code i am currently trying to get to work - although i would rather have the image fade in and out based on the thumbpos of the scroll bar - if anyone knows how to to this then i would appreciate your help! Thank you

Re: Adjusting image opacity using slider

Posted: Tue Nov 05, 2013 3:02 pm
by Klaus
Hi calmrr3,

set the startvalue of the sb to 0 and the endvalue of the sb to 100.
Then add this script to the sb:

Code: Select all

## This handler has one parameter -> the current thumbposition!
## This param is updated in REAL TIME!
on scrollbardrag tThumbPos
  set the blendlevel of img "strip1" to tThumbPos
end scrollbardrag
:D

Best

Klaus

Re: Adjusting image opacity using slider

Posted: Tue Nov 05, 2013 3:04 pm
by Traxgeek
Hi,

Just a quick thought !

on scrollbardrag N
set the blendlevel of img "strip1" to N
end scrollbardrag

HTH

Regards

Re: Adjusting image opacity using slider

Posted: Tue Nov 05, 2013 3:10 pm
by Traxgeek
Damn ! Beat me to it Klaus !!

Re: Adjusting image opacity using slider

Posted: Tue Nov 05, 2013 3:41 pm
by calmrr3
Thanks! :)

Re: Adjusting image opacity using slider

Posted: Tue Apr 07, 2020 3:41 pm
by kelyanok
hello
i want to use a scrollbar to adjust the penheight and the penwidth to make a drawing game; i used your code Klaus but it didnt worked..

Code: Select all

on scrollbardrag tThumbPos
   set the penheight to tThumbPos
   set the penwidth to tThumbPos
end scrollbardrag
what did i do wrong??

Kelyan

Re: Adjusting image opacity using slider

Posted: Tue Apr 07, 2020 3:56 pm
by richmond62
There are no properties penheight and penwidth
as far as I can tell in the documentation.

You might get a bit further using lineSize.

Make this your "spiritual home":
-
Dick.png

Re: Adjusting image opacity using slider

Posted: Tue Apr 07, 2020 4:00 pm
by Klaus
Hi kelyanok,

please create a new thread next time, this one is from 2013! 8)

As Richmoind said, please consult the dictionary if in doubt!
It will tell you that "penheight" and "penwidth" are both deprecated equivalents to LINESIZE.

And setting -> set the LINESIZE to 10 will affect the PAINT tool "line".


Best

Klaus