Adjusting image opacity using slider

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

Post Reply
calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Adjusting image opacity using slider

Post by calmrr3 » Tue Nov 05, 2013 2:44 pm

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

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Adjusting image opacity using slider

Post by Klaus » Tue Nov 05, 2013 3:02 pm

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

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Adjusting image opacity using slider

Post by Traxgeek » Tue Nov 05, 2013 3:04 pm

Hi,

Just a quick thought !

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

HTH

Regards
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Adjusting image opacity using slider

Post by Traxgeek » Tue Nov 05, 2013 3:10 pm

Damn ! Beat me to it Klaus !!
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

calmrr3
Posts: 100
Joined: Mon Oct 28, 2013 2:39 pm

Re: Adjusting image opacity using slider

Post by calmrr3 » Tue Nov 05, 2013 3:41 pm

Thanks! :)

kelyanok
Posts: 22
Joined: Sun Feb 23, 2020 8:48 am
Location: Belgium

Re: Adjusting image opacity using slider

Post by kelyanok » Tue Apr 07, 2020 3:41 pm

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

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

Re: Adjusting image opacity using slider

Post by richmond62 » Tue Apr 07, 2020 3:56 pm

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

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Adjusting image opacity using slider

Post by Klaus » Tue Apr 07, 2020 4:00 pm

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”